2 ms·
I believe compilers are constrained by a combination of ABI and the standard here. Section 6.3.1.1 of the C11 draft states [0]: > If an int can represent al
by aw1621107 7y ago
I believe compilers are constrained by a combination of ABI and the standard here. Section 6.3.1.1 of the C11 draft states [0]:
> If an int can represent all values of the original type (as restricted by the width, for a bit-field), the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions. All other types are unchanged by the integer promotions.
So the type that the compiler promotes to is determined entirely by the widths of unsigned short and signed int, which in turn are defined by the ABI. There is no room for picking a different promotion here.
[0]: http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf