Daily bit(e) of C++ | anonymous namespace
Daily bit(e) of C++ ♻️169, Controlling the visibility of symbols using anonymous namespaces.
Anonymous (unnamed) namespaces are a modern tool for controlling the linkage of symbols (since C++11).
Any symbols inside an unnamed namespace will have internal linkage (symbols will only be visible to the translation unit).
Note that while there can be only one instance of a symbol with external linkage in a program, symbols with internal linkage can be repeated across different units.
How is a symbol in anonymous namespace different than a symbol marked as static?