*This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
Core Issues List revision 110b.
See http://www.open-std.org/jtc1/sc22/wg21/ for the official
list.*

2023-01-15

#### 689.
Maximum values of signed and unsigned integers

**Section: **6.8.2 [basic.fundamental]
**Status: **CD5
**Submitter: **James Kanze
**Date: **30 March, 2008

[Resolved by paper P1236R1, adopted at the November, 2018 meeting.]

The relationship between the values representable by corresponding
signed and unsigned integer types is not completely described, but
6.8 [basic.types] paragraph 4 says,

The *value representation* of an object is the set of bits that
hold the value of type `T`.

and 6.8.2 [basic.fundamental] paragraph 3 says,

The range of nonnegative values of a signed integer type is a
subrange of the corresponding unsigned integer type, and the
value representation of each corresponding signed/unsigned type
shall be the same.

I.e., the maximum value of each unsigned type must be larger
than the maximum value of the corresponding signed type.

C90 doesn't have this restriction, and C99 explicitly says
(6.2.6.2, paragraph 2),

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*).

Unlike C++, the sign bit is not part of the value, and on an
architecture that does not have native support of unsigned types,
an implementation can emulate unsigned integers by simply
ignoring what would be the sign bit in the signed type and be
conforming.

The question is whether we intend to make a conforming
implementation on such an architecture impossible. More
generally, what range of architectures do we intend to
support? And to what degree do we want to follow C99 in
its evolution since C89?

(See paper J16/08-0141 = WG21 N2631.)