Results for g++ 3.1 application testing on i686-pc-linux-gnu
Benjamin Kosnik
bkoz@redhat.com
Tue Mar 5 17:25:00 GMT 2002
> I thought C++ allowed us to never emit these unless their
> address is taken? If that's the case, I'd consider this
> a (qoi) bug.
Well, for "C" there is always making -fno-common the default, if it
wasn't const...
:)
I'm not quite sure of C++ linkage rules for const ints. Jason's away, so
perhaps somebody else can weigh in. To me, this seems to be clearly
internal linkage, and thus able to be optimized.
>From 3.5, linkage:
* When a name has internal linkage, the entity it denotes can be
referred to by names from other scopes in the same translation unit.
[...]
* an object or reference that is explicitly declared const and
neither explicitly declared extern nor previously declared to have
external linkage; or
Perhaps I'm missing something.
FWIW, icc also does this, but it's not in read-only...
00000000 d i
So, who knows. If there is no clear consensus on this from the
compiler-folk within a couple days, I think the thing to do is make the
source code changes to enums so that application testing can proceed.
-benjamin
More information about the Gcc
mailing list