Believe it or not, if the expression C is formed of two arguments, one with a type int
and the other with a type unsigned
, then the value int
will be raised to a type unsigned
for comparison.
So, in your case y
, the type is assigned unsigned
. Since it is negative, it will be transformed by adding to it UINT_MAX + 1
, and it will take on value UINT_MAX - 1
.
Therefore, there x > y
will be 0.
, . . : , gcc, -Wextra
, .