Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#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)

array_warnings.patch (942 bytes ) - added by Paul A. Bristow 14 years ago.
suppress warnings in Boost.array

Download all attachments as: .zip

Change History (10)

by Paul A. Bristow, 14 years ago

Attachment: array_warnings.patch added

suppress warnings in Boost.array

comment:1 by Steven Watanabe, 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.

in reply to:  1 ; comment:2 by Paul A. Bristow, 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?

in reply to:  2 comment:3 by anonymous, 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 Marshall Clow, 13 years ago

Owner: changed from No-Maintainer to Marshall Clow

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.

comment:5 by Marshall Clow, 13 years ago

Status: newassigned

in reply to:  5 ; comment:6 by Paul A. Bristow, 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?).

in reply to:  6 comment:7 by Marshall Clow, 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 Marshall Clow, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [59476]) Applied patches to fix #2886

comment:9 by dimentiy, 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). :(

Note: See TracTickets for help on using tickets.