This is the mail archive of the gcc-patches@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]

Re: Static linkage and anonymous namespace



>>>>> "Martin" == Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> 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.

Martin --

  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 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com


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