This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Getting 3.3 out the door
On Thu, 2003-04-10 at 15:43, Branko Čibej wrote:
> Joe Buck wrote:
>
> >There is a relatively simple, though controversial, "fix": treat
> >anonymous namespace names as static. There are some problems with
> >that solution, for example, the question of what happens if there's
> >a template defined on a type declared in the anonymous namespace, as
> >well as a few other oddities like that, but the committee intended
> >anonymous namespaces to replace "static", so in the majority of cases
> >it should be possible to handle it in the same way.
> >
>
> If I understand correctly, symbols that are defined in an anonymous
> namespace can't be used from outside the compilation unit, regardless of
> their linkage. If that's correct, then generating a UUID every time a
> file is compiled, and using that for the namespace name (suitably
> protected with leading underscores), would solve the problems, wouldn't
> it? It doesn't matter if a later compile of the same file with the same
> compiler options used a different namespace name, because things like
> teimpate instantiations based on the anonymous-namespace types would be
> regenerated anyway.
We've been here before. :-)
We used to randomize the names, which works nicely.
But some programs can use the anonymous namespace members from a place
that is very much like "outside the compilation unit".
Furthermore, non-deterministic compilation was considered a misfeature.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com