(C++) external linkage
February 24, 2017 · View on GitHub
(C++) external linkage
'A name has external linkage if, in a multi-file program, that name can interact with other translation units at link-time' [1].
Avoid data with external linkage at file scope [2].
Avoid free functions with external linkage (including operator functions) in implementation (.cpp) files [3].
References
- John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 1.1.2, page 24: 'DEFINITION: A name has external linkage if, in a multi-file program, that name can interact with other translation units at link time.'
- John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.3.1, page 70: 'Avoid data with external linkage at file scope'
- John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.3.2, page 72: 'Avoid free functions (except operator functions) at file scope in .h files; avoid free functions with external linkage (including operator functions) in .c files