That might be half of the explanation. It doesn't matter whether 0xf0 in "c = 0xf0" gets truncated, or is considered a negative number. You could ask, why doesn't the same happen to the 0xf0 in "c==0xf0". Well, that's because numeric literals are considered integers. When you compare two basic types, the smaller one is converted to the bigger one, so char==int performs a int==int rather than a char==char. Therefore nothing happens to that 0xf0. If you instead wrote "c == char(0xf0)" it should work fine.