6.9 External definitions

Previous Table of Contents "New C Standard" commentary

1810

translation-unit:
                external-declaration
                translation-unit external-declaration

external-declaration: function-definition declaration

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

1812 There shall be no more than one external definition for each identifier declared with internal linkage in a translation unit.

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

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

1815 These are described as “external” because they appear outside any function (and hence have file scope).

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

1817 An external definition is an external declaration that is also a definition of a function (other than an inline definition) or an object.

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

1819 otherwise, there shall be no more than one.137)

1820 137) Thus, if an identifier declared with external linkage is not used in an expression, there need be no external definition for it.

Next

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