This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Why are variables in anonymous namespaces not static?


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]