http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45831

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2010-09-30 
12:12:17 UTC ---
(In reply to comment #10)
> To get to know what a formula does, I usually compute some examples. When 
> doing
> so, I was warned, but ignored them and that was stupid.
> 
> There are however also warnings that are stupid. I now think of setting an
> integer to -2147483648. 2147483648 is too large for an integer and it is good
> that the compiler warns you. Unfortunately, the compiler ignores the context 
> of
> 2147483648 and thus warns for -2147483648 as well. A similar argument applies
> for setting an unsigned to a value in the range 2147483648 to 4294967295. 
> 
> On the other hand, setting an unsigned to a negative value does not give any
> warning. Setting an unsigned to e.g. -1 is totally unnecessary, since you can
> write ~0 instead, which is also preferable.

See: http://gcc.gnu.org/wiki/NewWconversion#Frequently_Asked_Questions

Please search also the C FAQs, your answers are there. We cannot change how C
works, even if it seems counter-intuitive at first glance.

If you find another specific problem, please open a new PR with a complete
testcase and expected/obtained output.

Reply via email to