Why are variables in anonymous namespaces not static?

Geoffrey Keating geoffk@apple.com
Fri May 2 01:06:00 GMT 2003


Can anyone tell me why

namespace { int i; }

doesn't give `i' static linkage?

`i' will be given a random assembler name like 
_ZN20_GLOBAL__N_x.hOCQSA11iE which surely can't be referenced outside 
this compilation anyway, since no other compilation will know what it 
is.  (The case for constructors is different, because they're found by 
collect2.)

-- 
Geoff Keating <geoffk@apple.com>



More information about the Gcc mailing list