This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Getting 3.3 out the door
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.
--
Brane Čibej <brane at xbc dot nu> http://www.xbc.nu/brane/