This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Strange sign-compare results
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc-bugs at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Sun, 16 Dec 2001 21:55:23 +0000
- Subject: Re: Strange sign-compare results
- References: <200112162112.QAA24486@caip.rutgers.edu>
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.