char byte = 0x80
if(byte == 0x80)
{
cout << "This message never gets printed!";
}
The hexadecimal value 0x80
is equivalent in binary to 1000 0000
, which clearly fits in a byte.
However, the compiler warns me about the line with the conditional:
warning: comparison is always false due to limited range of data type
Why is the result of the conditional false in this case?
Is 0x80
getting expanded in the conditional to something like 0x80000000
?
Is it possible to use the ==
operator to check if a char
equals 0x80
?