Re: string operation??



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.

.



Relevant Pages

  • Re: Four or Two Bytes?
    ... Not on the DS9K. ... unsigned short can have INT_MAX padding bytes on the DS9K. ... For unsigned integer types other than unsigned char, ... the bits of the object representation shall be divided into ...
    (comp.lang.c)
  • Re: Direct computation of integer limits in K&R2?
    ... For signed integer types, ... representation shall be divided into three groups: ... padding bits; there shall be exactly one sign bit. ...
    (comp.lang.c)
  • Re: Newbie - itoa implementation
    ... The quantity of object representation bits, ... all integer types may contain padding ... signed int, an extremely improbably possibility, then perhaps this ...
    (comp.lang.c)
  • Re: very much new to c need ur help
    ... David Thompson wrote: ... For signed integer types, ... representation shall be divided into three groups: ... padding bits; there shall be exactly one sign bit. ...
    (comp.lang.c)
  • Re: Four or Two Bytes?
    ... Not on the DS9K. ... unsigned short can have INT_MAX padding bytes on the DS9K. ... For unsigned integer types other than unsigned char, ... the bits of the object representation shall be divided into ...
    (comp.lang.c)