I am using gcc 4.8.3 in Fedora 19 64 bit
unsigned u1=10, u2=42; unsigned short us1=10, us2=42; int main() { cout << "u1-u2="<<u1-u2<<", us1-us2="<<us1-us2<<endl; }
Result: u1-u2 = 4294967264, us1-us2 = -32
<<the statement seems to interpret the result of the second operation as a
signed short whereas it interprets the result of the first operation as
unsigned int
source share