Subject: Re: [boost] Official warnings policy?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-11-04 14:14:42
On Wed, Nov 4, 2009 at 10:56 AM, Zachary Turner <divisortheory_at_[hidden]> wrote:
> On Wed, Nov 4, 2009 at 12:29 PM, Emil Dotchevski
>> On Wed, Nov 4, 2009 at 10:03 AM, Mateusz Loskot <mateusz_at_[hidden]>
>> > John Maddock wrote:
>> > By the way, building Boost gives large number of warnings related to
>> > strict aliasing.
>> As long as these warnings report actual violation of the C++ standard
>> (as opposed to warning about a potential for violation) they should be
>> fixed IMO.
> I'm not sure I agree. If something is a violation of the C++ standard the
> compiler shouldn't be reporting it as an error in the first place. For
> example, implicit conversion between numeric types losing precision is going
> to issue a warning on MSVC (not sure about GCC) but there's no violation of
> the standard anywhere. Perhaps this is what you meant and I'm just taking
> what you said too literally.
My comment was specifically about strict aliasing warnings. I meant
that if the compiler warns that reinterpret_cast is dangerous and
tricky, that's not news to me. :)
For example, a reinterpret_cast of a pointer may result in breaking
strict aliasing rules only if the resulting pointee type is
sufficiently different (strict aliasing rules define a few exceptions)
and only if the target pointer is actually dereferenced. At this point
there is a violation of the standard and the warning should be fixed:
another compiler could issue an error instead (at least in theory, in
practice strict aliasing rules are broken quite often in C.)
Reverge Studios, Inc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk