[support.types.layout] (original) (raw)

17 Language support library [support]

17.2 Common definitions [support.types]

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

The macrooffsetof(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.188

The expression offsetof(type, member-designator)is never type-dependent and it isvalue-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 andnoexcept(offsetof(type, member-designator)) shall be true.

The type ptrdiff_­t is animplementation-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 animplementation-defined unsigned integer type that is large enough to contain the size in bytes of any object ([expr.sizeof]).

[Note 1:

It is recommended that implementations choose types for ptrdiff_­t and size_­twhose integer conversion ranks are no greater than that ofsigned long int unless a larger size is necessary to contain all the possible values.

— _end note_]

The typemax_­align_­t is a trivial 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]).