Why are variables in anonymous namespaces not static?

Geoffrey Keating geoffk@apple.com
Fri May 2 04:59:00 GMT 2003


On Thursday, May 1, 2003, at 08:38  PM, Matt Austern wrote:

> On Thursday, May 1, 2003, at 06:06  PM, Geoffrey Keating wrote:
>
>> Can anyone tell me why
>>
>> namespace { int i; }
>>
>> doesn't give `i' static linkage?
>
> No good reason as far as I can tell, but that's what the C++ standard 
> calls for.  It may make a difference when and if we implement export.
>
If code can't tell, then under the as-if rule we can make them static 
(from the middle-end's point of view, that is; the frontend will still 
want to know the difference... or will it?); if export gets implemented 
then we can deal with that then, since export will be better able to 
deal with the namespace/distinctness issues involved.

(The motivation for this is to fix c++/10591.)



More information about the Gcc mailing list