6.9 External definitions

Syntax

1

translation-unit:

external-declaration

translation-unit external-declaration

external-declaration:

function-definition

declaration

Constraints

2

The storage-class specifiers auto and register shall not appear in the declaration specifiers in an external declaration.

3

There shall be no more than one external definition for each identifier declared with internal linkage in a translation unit. Moreover, if an identifier declared with internal linkage is used in an expression (other than as a part of the operand of a sizeof operator whose result is an integer constant), there shall be exactly one external definition for the identifier in the translation unit.

Semantics

4

As discussed in 5.1.1.1, the unit of program text after preprocessing is a translation unit, which consists of a sequence of external declarations. These are described as “external” because they appear outside any function (and hence have file scope). As discussed in 6.7, a declaration that also causes storage to be reserved for an object or a function named by the identifier is a definition.

5

An external definition is an external declaration that is also a definition of a function (other than an inline definition) or an object. If an identifier declared with external linkage is used in an expression (other than as part of the operand of a sizeof operator whose result is an integer constant), somewhere in the entire program there shall be exactly one external definition for the identifier; otherwise, there shall be no more than one.[1]

Footnotes