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

--- Comment #10 from Michiel <MichieldeB at aim dot com> 2010-09-30 11:23:58 
UTC ---
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.

Reply via email to