Rank
Integer conversion rank
Rank is a term that is only defined in the ISO-C99 standard, but the concept applies just as well in C90 and is helpful in the discussion of integer type conversion. It reflects the principle that integer types have an intrinsic ordering even when 2 different types share an identical internal representation.
In brief:
- No two signed integer types have the same rank even if they have the same representation.
- The rank of long int is greater than the rank of int which is greater than the rank of short which is greater than the rank of signed char.
- The rank of an unsigned integer type is the same as the rank of the corresponding signed integer type.
- The rank of char is equal to the rank of signed char and unsigned char
Floating conversion rank
Although the term rank is strictly only relevant to integer types, a similar principle can be usefully applied to floating types.
Thus:
- The floating rank of long double is greater than the floating rank of double which is greater than the floating rank of float.
Index