Strange sign-compare results

Neil Booth neil@daikokuya.demon.co.uk
Sun Dec 16 13:57:00 GMT 2001


Kaveh R. Ghazi wrote:-

> I.e. the last compare of "u < (u1-u2)" doesn't warn.  Is this a bug or
> feature?  Doesn't (u1-u2) become an integer?  Please explain. :-)

No, the type of the result is the type of the operands for most (all?)
operators in C.

The others convert the unsigned operand to signed, and therefore the
result of the subtraction is signed.

Neil.



More information about the Gcc-bugs mailing list