RAD Studio
ContentsIndex
PreviousUpNext
Anonymous namespaces

The C++ grammar allows you to define anonymous namespaces. To do this, you use the keyword namespace with no identifier before the enclosing brace.

namespace {          // Anonymous namespace
   // Declarations 
   }

All anonymous, unnamed namespaces in global scope (that is, unnamed namespaces that are not nested) of the same translation unit share the same namespace. This way you can make static declarations without using the static keyword. 

Each identifier that is enclosed within an unnamed namespace is unique within the translation unit in which the unnamed namespace is defined.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!