Unexpected behaviour using unsigned char in comparison

Jonathan Wakely jwakely.gcc@gmail.com
Sun Jan 9 19:46:00 GMT 2011


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.



More information about the Gcc-help mailing list