The association, or lack of association, between two identical identifiers is known as linkage. The kind of linkage that an identifier has depends on the way that it is declared.
Types of identifier linkage and their descriptions are:
Internal Linkage | Internal linkage occurs
where identical identifiers within a single source file
refer to the same data object or function. The following kinds of labels have internal linkage:
A variable that has static storage class can be defined within a block or outside of a function.
A class name that has no static members or non-inline member functions, and that has not been used in the declaration of an object, function, or class, is local to its translation unit. If the declaration of an identifier has the keyword extern, and if a previous declaration of the identifier is visible at file scope, the identifier has the same linkage as the first declaration. |
External Linkage | External linkage occurs
where identical identifiers in separately compiled files
refer to the same data object or function. The following kinds of identifiers have external linkage:
Identifiers declared with the keyword extern can be defined in other translation units. |
No Linkage | No linkage occurs where
each identical identifier refers to a unique object. The following kinds of identifiers have no linkage:
|