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]
Other format: [Raw text]

Re: Strange sign-compare results


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.


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