关于C#: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位宽度的体系结构上,尽管short的等级较低,int_least16_t是否可能是int的别名?


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?

您已引用了该标准的所有相关文本。 是的,如果shortint的大小相同,并且没有至少16位的较窄整数类型,则int_least16_t可以为int

实际上,如果实现仅支持64位整数,那么long long intlong intintshort int均为64位,则int_least16_t可能是long long int。 或者如果signed char在那个或其他实现中为16位宽,则int_least16_t可能为signed char。 或者在某些情况下,它可以是扩展的带符号整数类型,而不是上述任何一种。