The values given below shall be replaced by constant expressions suitable
for use in #if preprocessing directives. Moreover, except for CHAR_BIT
and MB_LEN_MAX, the following shall be replaced by expressions that have
the same type as would an expression that is an object of the corresponding
type converted according to the integer promotions. Their implementation-
defined values shall be equal or greater in magnitude (absolute value) to
those shown, with the same sign.
The key phrase is that the "implementation-defined values shall be equal or
greater in magnitude (absolute value) to those shown." The section then goes
on to define the minumum acceptable values for the following (plus some)
CHAR_BIT 8
SCHAR_MIN -127
SCHAR_MAX +127
UCHAR_MAX 255
The above imply that a character has at least 8 bits (but can be more).
Then
SHRT_MIN -32767
SHRT_MAX +32767
USHRT_MAX 65535
This implies at least 16 bits for short integers
Then
INT_MIN -32767
INT_MAX +32767
UINT_MAX 65535
This implies at least 16 bits for integers
Then
LONG_MIN -2147483647
LONG_MAX +2147483647
ULONG_MAX 4294967295
This implies at least 32 bits for long integers
Finally
LLONG_MIN -9223372036854775807
LLONG_MAX +9223372036854775807
ULLONG_MAX 18446744073709551615
And this implies at least 64 bits for long long integers
One thing to note about the above minimum limits. They allow for signed numbers
to be in either ones complement or twos complement without any problems. What
seems to be common practice is that "real" machines have int equal in size to
long int and small machines have int equal in size to short int. The only
constant that you can rely on is:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)
John Cochran
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/