2.9 Tentative Definitions

A declaration of an identifier with file scope, no initializer, and either no storage-class specifier or the static storage-class specifier is a tentative definition. The tentative definition only applies if no other definition of the object appears in the compilation unit, in which case all tentative definitions for an object are treated as if there were only one file scope definition of the object, with an initializer of zero.

If a definition for a tentatively defined object is used later in the compilation unit, the tentative definition is treated as a redundant declaration of the object. If the declaration of an identifier for an object is a tentative definition and has internal linkage, the declared type cannot be an incomplete type. Section 2.8 discusses linkage.

The following are examples of tentative definitions:

int i1 = 1;    /* Standard definition with external linkage      */
int i4;        /* Tentative definition with external linkage     */
static int i5; /* Tentative definition with internal linkage     */
int i1;        /* Valid tentative definition, refers to previous */
               /* i1 declaration                                 */


Previous Page | Next Page | Table of Contents | Index