4 ms·
They may have the same width, but not the same rank. From C99 §6.3.1.1: > — The rank of long long int shall be greater than the rank of long int, which shall
by jwilk 4y ago
They may have the same width, but not the same rank.
From C99 §6.3.1.1:
> — The rank of long long int shall be greater than the rank of long int, which
shall be greater than the rank of int, which shall be greater than the rank of short
int, […]
> — The rank of any unsigned integer type shall equal the rank of the corresponding
signed integer type, if any.
- moefh 4y agoThat's true, but it doesn't matter to the point being made. According to the standard[1], if short and int have the same size (even if not the same rank) both numbers are converted to unsigned int (that is, the unsigned integer type corresponding to int) because int can't represent all values of unsigned short. The usual arithmetic conversions never "promote" an unsigned to signed if doing so would change the value. [1] http://port70.net/~nsz/c/c99/n1256.html#6.3.1.8 http://port70.net/~nsz/c/c99/n1256.html#6.3.1.8
- deleted 4y ago[deleted]