Name
offsetof macro — Computes member offset
Synopsis
size_t offsetof(type
,member-name
)
The offsetof
macro returns
the offset, in bytes, of a member of a struct
as a constant integer. The
type
must be a plain, C-style struct
(Plain Old Data, or POD), and the
expression &(t
.member-name
)
must be an address constant,
assuming t
is an instance of
type
. In particular, this means the
member-name
must not be a bit-field, a
static member, or a function member. (See Chapter 6 for more information about
POD types.)
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.