6.7 Declarations

Previous Table of Contents "New C Standard" commentary

1348

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

1349 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.

1350 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.

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

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

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

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

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

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

1357 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.

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

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

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

1361 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;

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

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

Next

Created at: 2008-01-30 02:39:43 The text from WG14/N1256 is copyright © ISO