C++long is a standard signed integer type with a width of at least 32 bits. The spellings long int and signed long denote the same type. Do not assume, however, that long always has 64 bits or occupies a particular number of bytes.
Basic · C++23; repository compiler flag, production runtime not attestedC++`long double` is a distinct standard floating-point type with at least the precision of `double`. It guarantees neither extra precision nor a particular size. The `L` suffix creates literals of this type.
Basic · C++23; repository compiler flag, production runtime not attestedC++long long is a built-in signed integer type with a width of at least 64 bits. It is useful for large counters and integer calculations, but its range is still finite, and overflowing signed arithmetic causes undefined behavior.
Basic · C++23; repository compiler flag, production runtime not attestedC++short is a standard signed integer type equivalent to short int. Its width is at least 16 bits, but it need not occupy two bytes. In arithmetic, its values undergo integral promotion to int.
Basic · C++23; repository compiler flag, production runtime not attestedC++`signed char` is a built-in signed integer type, distinct from `char` and `unsigned char`. It occupies one C++ byte but need not have exactly 8 bits. It can represent small numeric values, including negative ones.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::byte from <cstddef> represents raw byte data. It is a distinct enumeration type, not an alias for unsigned char. It supports bitwise operations, but not ordinary arithmetic or implicit conversions to integer types.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::int16_t from <cstdint> is an optional alias for a signed integer type with exactly 16 bits and no padding bits. It stores values from -32768 to 32767; whether it is available depends on the implementation.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::int32_t from <cstdint> aliases a signed integer type with exactly 32 bits and no padding bits. Its range is -2147483648 through 2147483647. Whether this alias is available depends on the implementation.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::int64_t from <cstdint> is an alias for a signed integer type with exactly 64 bits and no padding bits. Its availability is optional; do not assume that it always means long long.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::int8_t from <cstdint> is an optional alias for a signed integer type with exactly 8 bits and no padding bits. It stores values from -128 to 127. Calculations follow integral promotion rules, and explicitly converting to int is useful when printing its numeric value.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::monostate is an empty type available through <variant>. It can represent an explicit state without data and, as the first std::variant alternative, enables default construction even when a later type has no default constructor.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::nullptr_t is the distinct type of the nullptr literal, made available by <cstddef>. It is not a pointer type: its values can produce null pointers, while the type itself lets function overloads recognize nullptr.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::ptrdiff_t is an implementation-defined signed integer type from <cstddef>. It is the result type of pointer subtraction, representing a distance in elements rather than bytes, and can hold negative values.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::size_t is an implementation-defined unsigned integer type that can represent the size of any object in bytes. It is the result type of sizeof and is declared by <cstddef>. Do not assume a particular width or use it to represent negative values.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::uint16_t from <cstdint> is an optional alias for an unsigned integer type with exactly 16 bits and a range of 0–65535. It is useful when an exact width is required, but it does not guarantee a two-byte size on every platform.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::uint32_t from <cstdint> aliases an unsigned integer type with exactly 32 bits and no padding bits. It holds values from 0 through 4294967295. Whether the alias is available depends on the implementation.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::uint64_t from <cstdint> is an optional alias for an unsigned integer type with exactly 64 bits and no padding bits. It stores values from 0 through 18446744073709551615.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::uint8_t from <cstdint> is an optional alias for an unsigned integer type with exactly 8 bits and a range of 0–255. It undergoes integral promotions in calculations and may behave as a character when printed.
Basic · C++23; repository compiler flag, production runtime not attestedC++std::uintptr_t from <cstdint> is an unsigned integer type that supports converting a valid void* to an integer and back without losing the pointer value. It is optional in C++23 and specifies neither a fixed width nor a portable address format.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++unsigned char is an unsigned integer type distinct from char and signed char. It occupies one C++ byte, not necessarily eight bits. It is useful for byte values, but undergoes integral promotions in expressions.
Basic · C++23; repository compiler flag, production runtime not attestedC++unsigned int stores nonnegative integers and is a distinct type from int. It has at least 16 value bits, and its arithmetic operates modulo 2^N. Learn the equivalent unsigned spelling and the pitfalls of conversions and comparisons involving signed integers.
Basic · C++23; repository compiler flag, production runtime not attestedC++unsigned long is a standard unsigned integer type with a width of at least 32 bits. It is the same type as unsigned long int. Its exact range depends on the implementation, and arithmetic performed in this type follows modular rules.
Basic · C++23; repository compiler flag, production runtime not attestedC++unsigned long long is a built-in unsigned integer type with at least 64 value bits. It stores nonnegative integers, and its arithmetic operates modulo 2^N. Its exact width depends on the implementation.
Basic · C++23; repository compiler flag, production runtime not attestedC++unsigned short is a built-in unsigned integer type, equivalent to unsigned short int. It supports at least the values from 0 through 65535, but need not be exactly 16 bits wide. In calculations, it is subject to integral promotions.
Basic · C++23; repository compiler flag, production runtime not attested