6.2.2 Linkages of identifiers

Previous Table of Contents "New C Standard" commentary

420 An identifier declared in different scopes or in the same scope more than once can be made to refer to the same object or function by a process called linkage.21)

421 There are three kinds of linkage: external, internal, and none.

422 In the set of translation units and libraries that constitutes an entire program, each declaration of a particular identifier with external linkage denotes the same object or function.

423 Within one translation unit, each declaration of an identifier with internal linkage denotes the same object or function.

424 Each declaration of an identifier with no linkage denotes a unique entity.

425 If the declaration of a file scope identifier for an object or a function contains the storage-class specifier static, the identifier has internal linkage.22)

426 For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible,23) if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration.

427 21) There is no linkage between different identifiers.

428 22) A function declaration can contain the storage-class specifier static only if it is at file scope; see 6.7.1.

429 If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage.

430 If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern.

431 If the declaration of an identifier for an object has file scope and no storage-class specifier, its linkage is external.

432 The following identifiers have no linkage:

433 an identifier declared to be anything other than an object or a function;

434 an identifier declared to be a function parameter;

435 a block scope identifier for an object declared without the storage-class specifier extern.

436 If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined.

437 Forward references: declarations (6.7), expressions (6.5), external definitions (6.9), statements (6.8).

Next

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