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]

Re: Chill warning questions #2


[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




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