unsigned / double propagation weirdness?

Robert Dewar dewar@gnat.com
Mon Feb 23 18:00:00 GMT 2004


Giovanni Bajo wrote:

>>you certainly don't want to regard the use of unary
>>minus on unsigned as something you warn about.

> What's the rationale for this? I know that other compilers do implement this
> warning and I indeed found it useful in the past.

To me, unary minus on unsigned is both useful, and has a clear and 
expected meaning (take the twos complement). I would find it most
irritating to get warnings on this. If it is really the case that
many/most C programmers are bamboozled by this standard usage in
the language, perhaps there is an argument for a warning that can
be turned on, but I certainly would not want to see this in -Wall.



More information about the Gcc mailing list