Getting 3.3 out the door

Branko Čibej brane@xbc.nu
Thu Apr 10 22:58:00 GMT 2003


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@xbc.nu>   http://www.xbc.nu/brane/



More information about the Gcc mailing list