The
<cstddef> header is the C++ version of the C
standard <stddef.h> header, which declares a
few types and macros.
The C header declares the wchar_t type, but
wchar_t is a reserved keyword in C++, so there is
no need to #include
<cstddef> to declare this type.
The NULL macro expands to a null pointer constant,
such as 0 or 0L.
Some C libraries declare NULL as
((void*)0) in stddef.h. This
definition is fine for C, but is wrong for C++. Most C++ compilers
correctly declare NULL, but you should be aware of
the difference.
offsetof macro |
Computes member offset
|
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.)
ptrdiff_t type |
Pointer difference type
|
The ptrdiff_t type is a signed integral type that
represents the difference between two pointers. The exact type is
implementation-defined.
size_t type |
sizeof result type
|
The size_t type is the type of the result of the
sizeof operator. It is an unsigned integral type.
The exact type is implementation-defined.