C++ 中 int 的最小大小是多少?
What is the minimum size of an int in C++?
Cppreference.com 声明:
If no length modifiers are present, it's guaranteed to have a width of at least 16 bits.
然而,最新的标准草案只说:
Plain ints have the natural size suggested by the architecture of the execution environment.
仅添加脚注:
从标准的这些部分来看,int
的大小似乎完全取决于实现。 “最低 16 位”保证从何而来?
int
的最小大小符合 INT_MIN
不得小于 -32767
且 INT_MAX
至少为 +32767
的要求。请注意,这是 2^16-1 个可能的值,它允许 1 的补码与带符号的零表示。
Cppreference.com 声明:
If no length modifiers are present, it's guaranteed to have a width of at least 16 bits.
然而,最新的标准草案只说:
Plain ints have the natural size suggested by the architecture of the execution environment.
仅添加脚注:
从标准的这些部分来看,int
的大小似乎完全取决于实现。 “最低 16 位”保证从何而来?
int
的最小大小符合 INT_MIN
不得小于 -32767
且 INT_MAX
至少为 +32767
的要求。请注意,这是 2^16-1 个可能的值,它允许 1 的补码与带符号的零表示。