Plain ints are intended to have
the natural width suggested by the architecture of the execution environment;
the other signed integer types are provided to meet special needs.
For each of the standard signed integer types,
there exists a corresponding (but different)
standard unsigned integer type:
“unsignedchar”, “unsignedshortint”,
“unsignedint”, “unsignedlongint”, and
“unsignedlonglongint”.
An unsigned integer type has the same
object representation,
value representation, and
alignment requirements ([basic.align])
as the corresponding signed integer type.
For each value x of a signed integer type,
the value of the corresponding unsigned integer type
congruent to x modulo 2N has the same value
of corresponding bits in its value representation.40
The width of each signed integer type
shall not be less than the values specified in Table 12.
The value representation of a signed or unsigned integer type
comprises N bits, where N is the respective width.
Each set of values for any padding bits ([basic.types])
in the object representation are
alternative representations of the value specified by the value representation.
Each value x of an unsigned integer type with width N has
a unique representation x=x020+x121+…+xN−12N−1,
where each coefficient xi is either 0 or 1;
this is called the base-2 representation of x.
The base-2 representation of a value of signed integer type is
the base-2 representation of the congruent value
of the corresponding unsigned integer type.
The standard signed integer types and standard unsigned integer types
are collectively called the standard integer types, and the extended
signed integer types and extended
unsigned integer types are collectively called the
extended integer types.
A fundamental type specified to have
a signed or unsigned integer type as its underlying type has
the same object representation,
value representation,
alignment requirements ([basic.align]), and
range of representable values as the underlying type.
Further, each value has the same representation in both types.
Type wchar_t is a distinct type that has
an implementation-defined
signed or unsigned integer type as its underlying type.
The values of type wchar_t can represent
distinct codes for all members of the largest extended character set
specified among the supported locales ([locale]).
Type char8_t denotes a distinct type
whose underlying type is unsignedchar.
Types char16_t and char32_t denote distinct types
whose underlying types are uint_least16_t and uint_least32_t,
respectively, in <cstdint> ([cstdint.syn]).
Type bool is a distinct type that has
the same object representation,
value representation, and
alignment requirements as
an implementation-defined unsigned integer type.
The type double provides at least as much
precision as float, and the type longdouble provides at
least as much precision as double.
The set of values of the type
float is a subset of the set of values of the type
double; the set of values of the type double is a subset
of the set of values of the type longdouble.
The value
representation of floating-point types is implementation-defined.
: This document imposes no requirements on the accuracy of
floating-point operations; see also [support.limits]. — end note
]
Integral and floating-point types are collectively
called arithmetic types.
Specializations of the standard library template
std::numeric_limits shall specify the
maximum and minimum values of each arithmetic type for an
implementation.
An expression of type cvvoid shall
be used only as an expression statement, as an operand
of a comma expression, as a second or third operand
of ?: ([expr.cond]), as the operand of
typeid, noexcept, or decltype, as
the expression in a return statement for a function
with the return type cvvoid, or as the operand of an explicit conversion
to type cvvoid.