6.7 Declarations

Previous Table of Contents

1338

declaration:
                declaration-specifiers init-declarator-listopt ;

declaration-specifiers: storage-class-specifier declaration-specifiersopt type-specifier declaration-specifiersopt type-qualifier declaration-specifiersopt function-specifier declaration-specifiersopt

init-declarator-list: init-declarator init-declarator-list , init-declarator

init-declarator: declarator declarator = initializer

1339 A declaration shall declare at least a declarator (other than the parameters of a function or the members of a structure or union), a tag, or the members of an enumeration.

1340 If an identifier has no linkage, there shall be no more than one declaration of the identifier (in a declarator or type specifier) with the same scope and in the same name space, except for tags as specified in 6.7.2.3.

1341 All declarations in the same scope that refer to the same object or function shall specify compatible types.

1342 A declaration specifies the interpretation and attributes of a set of identifiers.

1343 A definition of an identifier is a declaration for that identifier that:

1344 —  for an object, causes storage to be reserved for that object;

1345 —  for a function, includes the function body;99)

1346 —  for an enumeration constant or typedef name, is the (only) declaration of the identifier.

1347 The declaration specifiers consist of a sequence of specifiers that indicate the linkage, storage duration, and part of the type of the entities that the declarators denote.

1348 The init-declarator-list is a comma-separated sequence of declarators, each of which may have additional type information, or an initializer, or both.

1349 99) Function definitions have a different syntax, described in 6.9.1.

1350 The declarators contain the identifiers (if any) being declared.

1351 If an identifier for an object is declared with no linkage, the type for the object shall be complete by the end of its declarator, or by the end of its init-declarator if it has an initializer;

1352 in the case of function arguments (including in prototypes), it is the adjusted type (see 6.7.5.3) that is required to be complete.

1353 Forward references: declarators (6.7.5), enumeration specifiers (6.7.2.2), initialization (6.7.8).

Next

Created at: 2005-06-29 02:19:01 The text from WG14/N1124 is copyright © ISO