The offsetof() macro takes two parameters, the first being a structure or union name, and the second being the name of a subobject of the structure/union that is not a bit field.
[citation needed] An alternative is: It may be specified this way because the standard does not specify that the internal representation of the null pointer is at address zero.
Some modern compilers (such as GCC) define the macro using a special form (as a language extension) instead, e.g.[3] This builtin is especially useful with C++ classes that declare a custom unary operator &.
Usage of offsetof is limited to POD types in C++98, standard-layout classes in C++11,[7] and more cases are conditionally-supported in C++17,[8] otherwise it has an undefined behavior.
[9] The following program will generate several warnings and print obviously suspicious results when compiled with gcc 4.7.3 on an amd64 architecture: Output is: