Re: template instantiation and anonymous namespaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux