Friday 22 June 2012

What is the difference between external and internal linkage?

What is external linkage and internal linkage in C++? (SO)

Internal linkage: symbol is visible only within compilation unit where it is defined
External linkage: symbols is visible across multiple compilation units

C specific:
- non-static variables and functions have external linkage by default
- static variables and functions have external linkage

C++ specific:
- global variable, function, class, enumeration, namespace have external linkage by default

No comments:

Post a Comment