Random832 wrote:
Is CHAR_MAX allowed to be a value other than a power of two minus one?
In N1124, 6.2.6.2., paragraph 1 we read
For unsigned integer types other than
unsigned char, the bits of the object
representation shall be divided into two
groups: value bits and padding bits (there
need not be any of the latter). If there are N
value bits, each bit shall represent a different
power of 2 between 1 and 2^(N-1), so that objects
of that type shall be capable of representing values
from 0 to 2^N - 1 using a pure binary representation;
this shall be known as the value representation.
And in paragraph 2 we read
For signed integer types, the bits of the object
representation shall be divided into three groups:
value bits, padding bits, and the sign bit. There
need not be any padding bits; there shall be exactly
one sign bit. Each bit that is a value bit shall have
the same value as the same bit in the object
representation of the corresponding unsigned type
(if there are M value bits in the signed type and N in
the unsigned type, then M <= N).
>From the above I'm led to think that the maximum value
of any integer type is a power of 2 minus 1.