From the C++ compiler’s point of view, is namespace just a name decoration convention? I have inspected the generated assembly listing and found that everything just looks the same except the identifiers are decorated by the namespace’s name.
From the C++ compiler’s point of view, is namespace just a name decoration convention?
Share
As you point out, name mangling is part of the story (but the reasons for doing it have more to do with linkers rather than compilers).
However, name mangling is far from the whole story as far as the handling of namespaces in the compiler is concerned. Among other things, the compiler has to be able to figure out unqualified names, which can be non-trivial: see argument-dependent lookup.