This is the mail archive of the
mailing list for the GCC project.
Re: Static linkage and anonymous namespace
- To: martin at mira dot isdn dot cs dot tu-berlin dot de
- Subject: Re: Static linkage and anonymous namespace
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Sun, 30 Aug 1998 13:59:21 -0700
- CC: egcs-patches at cygnus dot com
- References: <199808302001.WAA28880@mira.isdn.cs.tu-berlin.de>
- Reply-to: mark at markmitchell dot com
>>>>> "Martin" == Martin von Loewis <firstname.lastname@example.org> writes:
Martin> Under the as-if rule, a conforming C++ compiler can avoid
Martin> making members of anonymous namespaces accessible to other
Martin> translation units. For g++, the unique name of the
Martin> anonymous namespace is not entirely unique, so making
Martin> those identifiers .local improves conformance.
I'm all for the end-result of this idea.
But why can't we just make the definitions have internal linkage if
they're in an anonymous namespace? Why do we need to introduce the
TREE_PRIVATE bit? In other words, at some point the compiler decides
whether to make things have internal or external linkage. Why doesn't
it just use the DECL_CONTEXT (recursively looking at parent contexts)
to see what linkage the thing should get?
Mark Mitchell email@example.com
Mark Mitchell Consulting http://www.markmitchell.com