The following kinds of identifiers have no linkage:
- Names that have neither external nor internal linkage
- Names declared in local scopes (with exceptions of certain
entities declared with the extern keyword)
- Identifiers that do not represent an object or a function, including
labels, enumerators, typedef names that refer to
entities with no linkage, type names, function parameters
You cannot use a name with no linkage to declare an entity
with linkage. For example, you cannot use the name of a structure
or enumeration or a
typedef name referring to an
entity with no linkage to declare an entity with linkage. The following
example demonstrates this:
int main() {
struct A { };
// extern A a1;
typedef A myA;
// extern myA a2;
}
The compiler will not allow the declaration of a1 with
external linkage. Structure A has no linkage. The
compiler will not allow the declaration of a2 with
external linkage. The typedef name myA has
no linkage because A has no linkage.