Getting 3.3 out the door
Joe Buck
jbuck@synopsys.com
Thu Apr 10 22:50:00 GMT 2003
On Thu, Apr 10, 2003 at 03:33:03PM -0700, Mark Mitchell wrote:
> These functions get external linkage because the C++ standard says they
> do. On the other hand, I've never been able to figure out whether a
> conforming program could actually *tell*. Adding "export" into the mix
> makes it more complicated; now an export template defined in that file
> but instantiated somewhere else can see the members of the anonymous
> namespace.
Exactly! In the majority of cases there is no conforming program that
can tell the difference between file-static and anonymous namespace.
It appears that exported templates can tell, and there may be a couple
of other similar cases.
My suggestion is to avoid emitting globals for anonymous namespace members
until the end of the unit, at which point any that must be generated are
generated. Names are flagged as "must be generated" when a situation
like a use in an exported template occurs. There may be others, but
I expect them to be rare.
More information about the Gcc
mailing list