This is the mail archive of the
mailing list for the GCC project.
- From: Kevin Atkinson <kevina at gnu dot org>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 31 Jan 2004 04:40:06 -0500 (EST)
- Subject: Anonymous Namespaces
Is there a reason gcc 3.4 does not treat functions inside an anonymous
namespace as having static linkage. In particular 'gcc -O3' inlines "f"
but still emits code for it in the following simple example:
std::cout << "Hello\n";
If I include static in front of "void f()" gcc does not emit code for "f".
I see this as a serious limitations for C++ programs as it means that the
new unit-at-a-time optimizations will be of limited usefulness since
member functions can not be declared to have static linkage.
It would seam to me that all functions (and variables for that matter)
inside an anonymous namespace should have static linkage since they can
only be used inside the current file.
So, is there a reason there not? If so, is there a way to declare member
functions as having static linkage so that the unit-at-a-time code can
Thanks in advance.
Reading specs from /opt/gcc/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../src/configure --prefix=/opt/gcc/
Thread model: posix
gcc version 3.4.0 20040128 (prerelease)