Next:Determining the Alignment of Functions, Types or Variables, Previous:The maximum and minimum representable values of a type, Up:Other Extensions to C Syntax [Contents][Index]
offsetof ¶GCC implements for both C and C++ a syntactic extension to implementtheoffsetof macro.
primary: "__builtin_offsetof" "("typename "," offsetof_member_designator ")"offsetof_member_designator:identifier | offsetof_member_designator "."identifier | offsetof_member_designator "["expr "]"This extension is sufficient such that
#define offsetof(type,member) __builtin_offsetof (type,member)
is a suitable definition of theoffsetof macro. In C++,typemay be dependent. In either case,member may consist of a singleidentifier, or a sequence of member accesses and array references.