This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: template instantiation and anonymous namespaces
- From: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- To: Stefan Lampe <stefanlampe at hotmail dot com>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 15 Jul 2009 04:25:15 -0700
- Subject: 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