#2886 closed Bugs (fixed)
Boost.Array gives MS warnings C4510 and C4610
Reported by: | Paul A. Bristow | Owned by: | Marshall Clow |
---|---|---|---|
Milestone: | Boost 1.39.0 | Component: | array |
Version: | Boost 1.38.0 | Severity: | Cosmetic |
Keywords: | array warning | Cc: |
Description
Boost.Array gives MS warnings C4510 and C4610 in simple use.
boost::array<const double, 99> stuff = { 9.206343, ....}
Unless anyone can see that this should be fixed 'properly', a patch to push'n'pop and disable these annoying warnings is attached.
Attachments (1)
Change History (10)
by , 14 years ago
Attachment: | array_warnings.patch added |
---|
follow-up: 2 comment:1 by , 13 years ago
Why array<const double, 99> rather than const array<double, 99>?
Also, array<const double, 99> does not quite work correctly, because iterator::value_type is const double rather than double.
follow-up: 3 comment:2 by , 13 years ago
Replying to steven_watanabe:
Why array<const double, 99> rather than const array<double, 99>?
Also, array<const double, 99> does not quite work correctly, because iterator::value_type is const double rather than double.
You are right, as always.
Asking for an array of const doubles still *feels* resonable.
So, since I am sure I am not the only one to suffer from constant const confusion, it might be useful to document that const array is best, and briefly why?
comment:3 by , 13 years ago
Replying to pbristow:
Asking for an array of const doubles still *feels* resonable.
So, since I am sure I am not the only one to suffer from constant const confusion, it might be useful to document that const array is best, and briefly why?
Sure. Now that I have a working doc toolchain again...
comment:4 by , 13 years ago
Owner: | changed from | to
---|
Some of this should be fixed in the 1.42 release candidate. Paul, can you check and see if this still occurs there? If so, I can add more warning suppression.
follow-up: 6 comment:5 by , 13 years ago
Status: | new → assigned |
---|
follow-up: 7 comment:6 by , 13 years ago
Replying to marshall:
I haven't got 1.42 rc yet, but the code appears unchanged in trunk?
I am still not clear if the warning should be suppressed (I suspect not suppressing is best) but the array docs should warn that to get an array with const values
boost::array<const double, 2> stuff = { 1.2, 3.4}; warnings
so use instead
const boost::array<double, 2> stuff = { 1.2, 3.4}; No warnings.
As Steven says, this is "because iterator::value_type is const double rather than double. "
(But the docs appear to me to be in XML :-( so editing may be troublesome?).
comment:7 by , 13 years ago
Replying to pbristow:
Replying to marshall:
I haven't got 1.42 rc yet, but the code appears unchanged in trunk?
Well, the code has been changed in the trunk. There was some warning suppression (though not specifically 4510 and 4610) added to that file after this bug was opened. I wanted to make sure (not having access to VC9) that this didn't take care of the problems reported here.
comment:8 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:9 by , 12 years ago
I've got those two in 1.41 and can't avoid it. Push and pop around the #include <boost/array.hpp> don't work (vc80). :(
suppress warnings in Boost.array