This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New gcc 4.0.0 warnings seem spurious


Vincent Lefevre wrote:-

> 
> Before the conversion, the value is representable in the type of
> the expression, and after the conversion (which is well-defined),
> it is still representable in the (new) type of the expression.
> 6.7.8#11 mentions the possible conversion. So, I disagree here.

Warnings aren't only intended for undefined things; they're
supposed to point out suspect constructs.  If my compiler didn't
warn about assigning a 32-bit quantity to an 8-bit one I'd
think it a poor implementation.

Even better, you can turn of the warning with a cast, making your
intent explicit to the compiler, so there's every reason to have
it on by default.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]