int_least16_t 是否可以作为 int 的别名而不是 short 的别名?
Is it possible for int_least16_t to be an alias for int rather than short?
从C99标准可以看出,int_least16_t保证至少有16位的宽度
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.
...
据我所知,该标准只限制了类型的最小宽度,不一定限制它们的等级。因此,在 int 和 short 的宽度均为 16 位的体系结构中,int_least16_t 是否可能是 int 的别名,尽管 short 的等级较低?
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?
您已经完整引用了标准的相关文本。是的,如果 short
与 int
的大小相同,并且没有至少 16 位的更窄的整数类型,那么 int_least16_t
可以是 int
.
确实,如果一个实现只支持 64 位整数,那么 long long int
、long int
、int
和 short int
都是 64 位的,那么 int_least16_t
可能是 long long int
。或者,如果 signed char
在那个或其他实现中是 16 位宽,那么 int_least16_t
可能是 signed char
。或者在某些情况下,它可能是扩展的有符号整数类型,而不是上述任何类型。
从C99标准可以看出,int_least16_t保证至少有16位的宽度
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.
...
据我所知,该标准只限制了类型的最小宽度,不一定限制它们的等级。因此,在 int 和 short 的宽度均为 16 位的体系结构中,int_least16_t 是否可能是 int 的别名,尽管 short 的等级较低?
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?
您已经完整引用了标准的相关文本。是的,如果 short
与 int
的大小相同,并且没有至少 16 位的更窄的整数类型,那么 int_least16_t
可以是 int
.
确实,如果一个实现只支持 64 位整数,那么 long long int
、long int
、int
和 short int
都是 64 位的,那么 int_least16_t
可能是 long long int
。或者,如果 signed char
在那个或其他实现中是 16 位宽,那么 int_least16_t
可能是 signed char
。或者在某些情况下,它可能是扩展的有符号整数类型,而不是上述任何类型。