[Xorp-hackers] namespace {..} vs static at file scope

Bruce M Simpson bms@spc.org
Tue, 2 Nov 2004 16:36:09 -0800

Whilst reading some notes regarding the C++ standard at the weekend:

For reasons it leaves unstated -- but which I suspect mostly involve
template difficulties -- the C++ standard considers internal linkage a
deprecated feature. In standardese, "deprecated" describes an ostensibly
obsolete feature that may be removed from a future standard revision.

Fortunately, the standard both giveth and taketh away: For the features
it deems deprecated, the standard typically provides more modern
alternatives. In the case of internal linkage, the recommended alternative
is the unnamed namespace.

This is more C++-like than C-like, but if 'static' meaning 'file scope
and internal linkage only' is taken away, things could get interesting.

It would be interesting to see what GCC's algorithm is, and to take
note of it.