Comment by nayuki

1 hour ago

Because the language rules say so, and I'm not the one who made the rules. https://en.cppreference.com/c/language/conversion#Integer_pr...

> Integer promotion is the implicit conversion of a value of any integer type with rank less or equal to rank of int or of {a bit-field of type _Bool(until C23)/bool(since C23), int, signed int, unsigned int}, to the value of type int or unsigned int.

> If int can represent the entire range of values of the original type (or the range of values of the original bit-field), the value is converted to type int. Otherwise the value is converted to unsigned int.

The fact that the C/C++ integer conversion rules have these unintuitive footguns is why I made it a talking point.