[support.types.layout]

# 17 Language support library [[support]](./#support)

## 17.2 Common definitions [[support.types]](support.types#layout)

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

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L291)

The macrooffsetof(*type*, *member-designator*) has the same semantics as the corresponding macro in
the C standard library header [<stddef.h>](support.c.headers.general#header:%3cstddef.h%3e "17.15.1 General [support.c.headers.general]"), but
accepts a restricted set of *type* arguments in this document[.](#1.sentence-1)

Use of the offsetof macro with a *type* other than a standard-layout class ([[class.prop]](class.prop "11.2 Properties of classes"))
is conditionally-supported[.](#1.sentence-2)[160](#footnote-160 "Note that offsetof is required to work as specified even if unary operator&amp; is overloaded for any of the types involved.")

The expression offsetof(*type*, *member-designator*) is never [type-dependent](temp.dep.expr "13.8.3.3 Type-dependent expressions [temp.dep.expr]") and it is[value-dependent](temp.dep.constexpr "13.8.3.4 Value-dependent expressions [temp.dep.constexpr]") if and only if *type* is
dependent[.](#1.sentence-3)

The result of applying the offsetof macro to
a static data member or a function member is undefined[.](#1.sentence-4)

No operation invoked by the offsetof macro shall throw an exception andnoexcept(offsetof(*type*, *member-designator*)) shall be true[.](#1.sentence-5)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L316)

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]](expr.add "7.6.6 Additive operators")[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L322)

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]](expr.sizeof "7.6.2.5 Sizeof"))[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L328)

*Recommended practice*: An implementation should choose types for ptrdiff_t and size_t whose integer conversion ranks ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) are no greater than that ofsigned long int unless a larger size is necessary to contain all the possible values[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L334)

The typemax_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]](basic.align "6.8.3 Alignment"))[.](#5.sentence-1)

std​::​is_trivially_default_constructible_v<max_align_t> is true[.](#5.sentence-2)

See also: ISO/IEC 9899:2024, 7.22

[160)](#footnote-160)[160)](#footnoteref-160)

Note that offsetof is required to work as specified even if unaryoperator& is overloaded for any of the types involved[.](#footnote-160.sentence-1)
