The following types are defined as integral types:

With the exception of sizeof(char) / sizeof(signed char) / sizeof(unsigned char), which is split between § 3.9.1.1 [basic.fundamental/1] and § 5.3.3.1 [expr.sizeof], and sizeof(bool), which is entirely implementation-defined and has no minimum size, the minimum size requirements of these types are given in section § 3.9.1 [basic.fundamental] of the standard, and shall be detailed below.

Size of char

All versions of the C++ standard specify, in § 5.3.3.1, that sizeof yields 1 for unsigned char, signed char, and char (it is implementation defined whether the char type is signed or unsigned).

char is large enough to represent 256 different values, to be suitable for storing UTF-8 code units.

Size of signed and unsigned integer types

The standard specifies, in § 3.9.1.2, that in the list of standard signed integer types, consisting of signed char, short int, int, long int, and long long int, each type will provide at least as much storage as those preceding it in the list. Furthermore, as specified in § 3.9.1.3, each of these types has a corresponding standard unsigned integer type, unsigned char, unsigned short int, unsigned int, unsigned long int, and unsigned long long int, which has the same size and alignment as its corresponding signed type. Additionally, as specified in § 3.9.1.1, char has the same size and alignment requirements as both signed char and unsigned char.

Prior to C++11, long long and unsigned long long were not officially part of the C++ standard. However, after their introduction to C, in C99, many compilers supported long long as an extended signed integer type, and unsigned long long as an extended unsigned integer type, with the same rules as the C types.

The standard thus guarantees that:

1 == sizeof(char)  == sizeof(signed char) == sizeof(unsigned char)
  <= sizeof(short) == sizeof(unsigned short)
  <= sizeof(int)   == sizeof(unsigned int)
  <= sizeof(long)  == sizeof(unsigned long)
<= sizeof(long long) == sizeof(unsigned long long)

Specific minimum sizes for each type are not given by the standard. Instead, each type has a minimum range of values it can support, which is, as specified in § 3.9.1.3, inherited from the C standard, in §5.2.4.2.1. The minimum size of each type can be roughly inferred from this range, by determining the minimum number of bits required; note that for any given platform, any type’s actual supported range may be larger than the minimum. Note that for signed types, ranges correspond to one’s complement, not the more commonly used two’s complement; this is to allow a wider range of platforms to comply with the standard.

|Type |Minimum range |Minimum bits required| |:—————––|:———————————————————————–:|––––––––––:| |signed char |-127 to 127 (-(27 - 1) to (27 - 1)) |8 | |unsigned char |0 to 255 (0 to 28 - 1) |8 | |signed short |-32,767 to 32,767 (-(215 - 1) to (215 - 1)) |16 | |unsigned short |0 to 65,535 (0 to 216 - 1) |16 | |signed int |-32,767 to 32,767 (-(215 - 1) to (215 - 1)) |16 | |unsigned int |0 to 65,535 (0 to 216 - 1) |16 | |signed long |-2,147,483,647 to 2,147,483,647 (-(231 - 1) to (231 - 1))|32 | |unsigned long |0 to 4,294,967,295 (0 to 232 - 1) |32 |

|Type |Minimum range |Minimum bits required| |:—————––|:—————————————————–:|––––––––––:| |signed long long |-9,223,372,036,854,775,807 to 9,223,372,036,854,775,807 (-(263 - 1) to (263 - 1))|64 | |unsigned long long|0 to 18,446,744,073,709,551,615 (0 to 264 - 1) |64 |