Chill warning questions #2
Per Bothner
bothner@cygnus.com
Thu Oct 15 09:52:00 GMT 1998
[Context: (signed char) (-1) == (unsigned char) 0xFF]
> This will only surprise those unfamiliar with 2's complement. I don't
> think the warning is worth it even in this case.
Not at all. I, who am very familiar with 2's complement, can see two
reasonable definitions:
(1) The arguments are compared as is using 8-bit compare.
The values are equal.
(2) The arguments are extended to int. The values are un-equal.
Without having actually checked, I would guess the standard says (2).
But the point is I'm not sure, and it is not unreasonable to
expect either.
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner
More information about the Gcc
mailing list