[support.types]

17 Language support library [support]

17.2 Common definitions [support.types]


17.2.1 Header <cstddef> synopsis [cstddef.syn]

17.2.2 Header <cstdlib> synopsis [cstdlib.syn]

17.2.3 Null pointers [support.types.nullptr]

17.2.4 Sizes, alignments, and offsets [support.types.layout]

17.2.5 byte type operations [support.types.byteops]


17.2.1 Header <cstddef> synopsis [cstddef.syn]

namespace std { using ptrdiff_t = see below; using size_t = see below; using max_align_t = see below; using nullptr_t = decltype(nullptr); enum class byte : unsigned char {}; template<class IntType> constexpr byte& operator<<=(byte& b, IntType shift) noexcept; template<class IntType> constexpr byte operator<<(byte b, IntType shift) noexcept; template<class IntType> constexpr byte& operator>>=(byte& b, IntType shift) noexcept; template<class IntType> constexpr byte operator>>(byte b, IntType shift) noexcept; constexpr byte& operator|=(byte& l, byte r) noexcept; constexpr byte operator|(byte l, byte r) noexcept; constexpr byte& operator&=(byte& l, byte r) noexcept; constexpr byte operator&(byte l, byte r) noexcept; constexpr byte& operator^=(byte& l, byte r) noexcept; constexpr byte operator^(byte l, byte r) noexcept; constexpr byte operator~(byte b) noexcept; template<class IntType> constexpr IntType to_integer(byte b) noexcept; } #define NULL see below #define offsetof(P, D) see below

The contents and meaning of the header are the same as the C standard library header , except that it does not declare the type wchar_t, that it does not define the macro unreachable, that it also declares the type byte and its associated operations ([support.types.byteops]), and as noted in [support.types.nullptr] and [support.types.layout].

See also: ISO/IEC 9899:2024, 7.21

17.2.2 Header <cstdlib> synopsis [cstdlib.syn]

The contents and meaning of the header are the same as the C standard library header , except that it does not declare the types wchar_t or once_flag, and does not declare the function call_once, and except as noted in [support.types.nullptr], [support.types.layout], [support.start.term], [c.malloc], [c.mb.wcs], [alg.c.library], [c.math.rand], and [c.math.abs].

[Note 1:

Several functions have additional overloads in this document, but they have the same behavior as in the C standard library.

— end note]

See also: ISO/IEC 9899:2024, 7.24

17.2.3 Null pointers [support.types.nullptr]

The type nullptr_t is a synonym for the type of a nullptr expression, and it has the characteristics described in [basic.fundamental] and [conv.ptr].

[Note 1:

Although nullptr's address cannot be taken, the address of another nullptr_t object that is an lvalue can be taken.

— end note]

The macro NULL is an implementation-defined null pointer constant.151

See also: ISO/IEC 9899:2024, 7.21

17.2.4 Sizes, alignments, and offsets [support.types.layout]

The macro offsetof(type, member-designator) has the same semantics as the corresponding macro in the C standard library header , but accepts a restricted set of type arguments in this document.

Use of the offsetof macro with a type other than a standard-layout class ([class.prop]) is conditionally-supported.152

The expression offsetof(type, member-designator) is never type-dependent and it is value-dependent if and only if type is dependent.

The result of applying the offsetof macro to a static data member or a function member is undefined.

No operation invoked by the offsetof macro shall throw an exception and noexcept(offsetof(type, member-designator)) shall be true.

The type ptrdiff_t is an implementation-defined signed integer type that can hold the difference of two subscripts in an array object, as described in [expr.add].

The type size_t is an implementation-defined unsigned integer type that is large enough to contain the size in bytes of any object ([expr.sizeof]).

Recommended practice: An implementation should choose types for ptrdiff_t and size_t whose integer conversion ranks ([conv.rank]) are no greater than that of signed long int unless a larger size is necessary to contain all the possible values.

The type max_align_t is a trivially copyable standard-layout type whose alignment requirement is at least as great as that of every scalar type, and whose alignment requirement is supported in every context ([basic.align]).

std​::​is_trivially_default_constructible_v<max_align_t> is true.

See also: ISO/IEC 9899:2024, 7.21

17.2.5 byte type operations [support.types.byteops]

template<class IntType> constexpr byte& operator<<=(byte& b, IntType shift) noexcept;

Constraints: is_integral_v<IntType> is true.

Effects: Equivalent to: return b = b << shift;

template<class IntType> constexpr byte operator<<(byte b, IntType shift) noexcept;

Constraints: is_integral_v<IntType> is true.

Effects: Equivalent to: return static_cast<byte>(static_cast<unsigned int>(b) << shift);

template<class IntType> constexpr byte& operator>>=(byte& b, IntType shift) noexcept;

Constraints: is_integral_v<IntType> is true.

Effects: Equivalent to: return b = b >> shift;

template<class IntType> constexpr byte operator>>(byte b, IntType shift) noexcept;

Constraints: is_integral_v<IntType> is true.

Effects: Equivalent to: return static_cast<byte>(static_cast<unsigned int>(b) >> shift);

constexpr byte& operator|=(byte& l, byte r) noexcept;

Effects: Equivalent to: return l = l | r;

constexpr byte operator|(byte l, byte r) noexcept;

Effects: Equivalent to: return static_cast<byte>(static_cast<unsigned int>(l) | static_cast<unsigned int>(r));

constexpr byte& operator&=(byte& l, byte r) noexcept;

Effects: Equivalent to: return l = l & r;

constexpr byte operator&(byte l, byte r) noexcept;

Effects: Equivalent to: return static_cast<byte>(static_cast<unsigned int>(l) & static_cast<unsigned int>(r));

constexpr byte& operator^=(byte& l, byte r) noexcept;

Effects: Equivalent to: return l = l ^ r;

constexpr byte operator^(byte l, byte r) noexcept;

Effects: Equivalent to: return static_cast<byte>(static_cast<unsigned int>(l) ^ static_cast<unsigned int>(r));

constexpr byte operator~(byte b) noexcept;

Effects: Equivalent to: return static_cast<byte>(~static_cast<unsigned int>(b));

template<class IntType> constexpr IntType to_integer(byte b) noexcept;

Constraints: is_integral_v<IntType> is true.

Effects: Equivalent to: return static_cast<IntType>(b);