c++ - Unnamed namespace access rules -


i looking on section 7.3.1.1 in c++03 standard expecting find description of access rules items defined in unnamed namespace.

the rules seem little different unnamed namespaces, since cannot qualify access items in one. know @ least within same translation unit, 1 can access items in unnamed namespace if not in namespace. example:

namespace {   int foo; }  void something() {   foo = 4; } 

if namespace had name, not this. so, rules defined in standard these exceptional rules apply unnamed namespaces?

an anonymous namespace treated as:

namespace unique_per_tu {     // stuff } using namespace unique_per_tu; 

i'll try find reference here in minute.

edit:

it appears found in 7.3.1.1/1

an unnamed namespace definition behaves if replaced by

namespace unique { /* empty body */ } using namespace unique; namespace unique { namespacebody } 

where occurrences of unique in translation unit replaced same identifier , identifier differs other identifiers in entire program.

the "fake" using brings namespace members global namespace discovered.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -