A8.3 Structure and Union Declarations
A structure is an object consisting of a sequence of named members of various types. A union is an object that contains, at different times, any one of several members of various types. Structure and union specifiers have the same form.
struct -or-union-specifier:
struct-or-union identifieropr { struct-declaration-list } struct-or-union identifier
struct -or-union:
struct union
A struct-declaration-list is a sequence of declarations for the members of the structure or union:
struct -declaration-list: struct -declaration
struct-declaration-list struct-declaration
struct -declaration:
specifier-qualifier-list struct-declarator-list
specifier-qualifier-list:
type-specifier specifier-qualifier-/istopt type-qualifier specifier-qualifier-listopt
struct-declarator-list: struct-declarator
struct-declarator-list , struct-declarator
Usually, a struct-declarator is just a declarator for a member of a structure or union. A structure member may also consist of a specified number of bits. Such a member is also called a bit-field, or merely field; its length is set off from the declarator for the field name by a colon.
struct -declarator: declarator
declaratoropt : constant-expression A type specifier of the form
struct-or-union identifier { struct-declaration-list }
declares the identifier to be the tag of the structure or union specified by the list. A
subsequent declaration in the same or an inner scope may refer to the same type by using the tag in a specifier without the list:
struct-or-union identifier
If a specifier with a tag but without a list appears when the tag is not declared, an incomplete type is specified. Objects with an incomplete structure or union type may be mentioned in contexts where their size is not needed, for example in declarations (not definitions), for specifying a pointer, or for creating a t y p e d e f , but not otherwise. The type becomes complete on occurrence of a subsequent specifier with that tag, and con- taining a declaration list. Even in specifiers with a list, the structure or union type being declared is incomplete within the list, and becomes complete only at the } terminating the specifier.
A structure may not contain a member of incomplete .type. Therefore, it is impossi- ble to declare a structure or union containing an instance of itself. However, besides here it comes:
(will be followed)
A structure is an object consisting of a sequence of named members of various types. A union is an object that contains, at different times, any one of several members of various types. Structure and union specifiers have the same form.
struct -or-union-specifier:
struct-or-union identifieropr { struct-declaration-list } struct-or-union identifier
struct -or-union:
struct union
A struct-declaration-list is a sequence of declarations for the members of the structure or union:
struct -declaration-list: struct -declaration
struct-declaration-list struct-declaration
struct -declaration:
specifier-qualifier-list struct-declarator-list
specifier-qualifier-list:
type-specifier specifier-qualifier-/istopt type-qualifier specifier-qualifier-listopt
struct-declarator-list: struct-declarator
struct-declarator-list , struct-declarator
Usually, a struct-declarator is just a declarator for a member of a structure or union. A structure member may also consist of a specified number of bits. Such a member is also called a bit-field, or merely field; its length is set off from the declarator for the field name by a colon.
struct -declarator: declarator
declaratoropt : constant-expression A type specifier of the form
struct-or-union identifier { struct-declaration-list }
declares the identifier to be the tag of the structure or union specified by the list. A
subsequent declaration in the same or an inner scope may refer to the same type by using the tag in a specifier without the list:
struct-or-union identifier
If a specifier with a tag but without a list appears when the tag is not declared, an incomplete type is specified. Objects with an incomplete structure or union type may be mentioned in contexts where their size is not needed, for example in declarations (not definitions), for specifying a pointer, or for creating a t y p e d e f , but not otherwise. The type becomes complete on occurrence of a subsequent specifier with that tag, and con- taining a declaration list. Even in specifiers with a list, the structure or union type being declared is incomplete within the list, and becomes complete only at the } terminating the specifier.
A structure may not contain a member of incomplete .type. Therefore, it is impossi- ble to declare a structure or union containing an instance of itself. However, besides here it comes:
Article 35 of GATT