The conversion rank is defined in 6.3.1.1/1
:
Every integer type has an integer conversion rank defined as follows:
— No two signed integer types shall have the same rank, even if they have the same representation.
— The rank of a signed integer type shall be greater than the rank of any signed integer type with less precision.
— The rank of
long long int
shall be greater than the rank oflong int
, which shall be greater than the rank ofint
, which shall be greater than the rank ofshort int
, which shall be greater than the rank ofsigned char
.— The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type, if any.
— The rank of any standard integer type shall be greater than the rank of any extended integer type with the same width.
— The rank of char shall equal the rank of signed char and unsigned char .
— The rank of
_Bool
shall be less than the rank of all other standard integer types.— The rank of any enumerated type shall equal the rank of the compatible integer type (see 6.7.2.2).
— The rank of any extended signed integer type relative to another extended signed integer type with the same precision is implementation-defined, but still subject to the other rules for determining the integer conversion rank.
— For all integer types
T1
,T2
, andT3
, ifT1
has greater rank thanT2
andT2
has greater rank thanT3
, thenT1
has greater rank thanT3
.
There is a rule regarding a signed integer type:
The rank of a signed integer type shall be greater than the rank of any signed integer type with less precision.
QUESTION: Can an extended unsigned integer type with higher precision has lesser integer conversion rank?
Consider size_t
and unsigned int
. The first one is an extended integer type and in case size_t
has lesser integer conversion rank than unsigned int
then integer promotion is applied to size_t
which may result in precision loss.