Export (0) Print
Expand All

Linkage in Names with File Scope

The following linkage rules apply to names (other than typedef and enumerator names) with file scope:

  • If a name is explicitly declared as static, it has internal linkage and identifies a program element inside its own translation unit.

  • Enumerator names and typedef names have no linkage.

  • All other names with file scope have external linkage.

Microsoft Specific

  • If a function name with file scope is explicitly declared as inline, it has external linkage if it is instantiated or its address is referenced. Therefore, it is possible for a function with file scope to have either internal or external linkage.

END Microsoft Specific

A class has internal linkage if it:

  • Uses no C++ functionality (for example, member-access control, member functions, constructors, destructors, and so on).

  • Is not used in the declaration of another name that has external linkage. This constraint means that objects of class type that are passed to functions with external linkage cause the class to have external linkage.

Community Additions

ADD
Show:
© 2014 Microsoft