[ fromfile: namespaces.xml id: anonymousnamespace ]
A namespace
without a name is an anonymous namespace.
This is similar to a static
global, or file scope identifier.
It is accessible from that point, down to the end of the file.[115]
Example 20.15 shows how anonymous namespaces can eliminate
the need for static
globals.
Example 20.15. src/namespace/anonymouse.h
namespace { const int MAXSIZE = 256; } void f1() { int s[MAXSIZE]; }
[115] Unless it appears inside another namespace (which the language permits), in which case the scope is further narrowed by the brackets of its enclosing namespace.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |