This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: template instantiation and anonymous namespaces


Hi Stefan,

> As I understand it, the anonymous namespace has internal linkage...

Sort of, but not really.  If you look at your object code, you will see that
the symbols in the anonymous namespace have external linkage.  (But the
symbol will be mangled with a different random prefix or suffix, or perhaps
some other unique-ifying technique.)

I'm not up on the latest C++0x.  Perhaps the anonymous namespaces have
external linkage is changed.  The "whys and wherefores" for external linkage
with anonymous namespace -- I can't remember off the top of my head.

GUIDELINE:  header files should not contain anonymous namespaces.  (At the
moment, I cannot think of any exceptions to that guideline.)

Sincerely,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]