From the C99 standard, I can see that int_least16_t is guaranteed to have a width of at least 16 bits.
7.18.1.2 Minimum-width integer types
...
The typedef name uint_leastN_t designates an unsigned integer type with a width of at least N , such that no unsigned integer type with lesser size has at least the specified width. Thus, uint_least16_t denotes an unsigned integer type with a width of at least 16 bits.
...
From what I can tell, the standard only puts restrictions on the minimum width of the types, and not necessarily their rank. So on an architecture where int and short both have a width of 16 bits, is it possible that int_least16_t could be an alias for int, despite the fact that short has lesser rank?
From what I can tell, the standard only puts restrictions on the minimum width of the types, and not necessarily their rank. So on an architecture where int and short both have a width of 16 bits, is it possible that int_least16_t could be an alias for int, despite the fact that short has lesser rank?
You have quoted the entirety of the relevant text of the standard. Yes, if short
is the same size as int
, and there is no narrower integer type with at least 16 bits, then int_least16_t
can be int
.
Indeed, if an implementation supported only 64-bit integers, so that long long int
, long int
, int
, and short int
were all 64 bits, then int_least16_t
could be long long int
. Or if signed char
were 16 bits wide in that or some other implementation then int_least16_t
could be signed char
. Or under some circumstances, it could be an extended signed integer type instead of any of the above.