18.2.2 guarantees that <climits>
has the same contents as the C library header <limits.h>
.
The ISO C90 standard is tricky to get hold of, which is a shame considering that C++ relies on it, but the section "Numerical limits" (numbered 2.2.4.2 in a random draft I tracked down on one occasion and have lying around) gives minimum values for the INT_MAX
etc. constants in <limits.h>
. For example ULONG_MAX
must be at least 4294967295, from which we deduce that the width of long
is at least 32 bits.
There are similar restrictions in the C99 standard, but of course those aren't the ones referenced by C++03.
This does not guarantee that long
is at least 4 bytes, since in C and C++ "byte" is basically defined to mean "char", and it is not guaranteed that CHAR_BIT
is 8 in C or C++. CHAR_BIT == 8
is guaranteed by both POSIX and Windows.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…