This is the mail archive of the gcc-help@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: Unexpected behaviour using unsigned char in comparison


On 9 January 2011 19:24, Falk S. wrote:
>
> Ok, that would be the "unexpected". I thought the unary operator~ needs no
> conversion (promotion) and therefore the return type is the same as the
> argument type.

Integral promotions are performed for operator ~ and int can represent
all the values of unsigned char, so the operand is promoted to int.


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