Xref: utzoo comp.lang.c++:5933 gnu.g++.bug:1256 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ron Guilmette) Newsgroups: comp.lang.c++,gnu.g++.bug Subject: Re: bug 12178901 (1.36.1) - linkage of global const objects Message-ID: <258E97BA.2902@paris.ics.uci.edu> Date: 19 Dec 89 20:19:06 GMT References: <1516@aber-cs.UUCP> Reply-To: Ron Guilmette Distribution: gnu Organization: University of California, Irvine - Dept of ICS Lines: 33 In article <1516@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes: >In article <8912171136.aa08237@ICS.UCI.EDU> rfg@ICS.UCI.EDU writes: > > // bug 12178901 - linkage of global const objects > > // What is the `linkage' of const objects in C++? > >storage class, not linkage: static > > // GCC generates code for the following such that `ci' has > // extern linkage, and such that its initial value is 99. > >Ansi C inanely mandates it. > > // G++ 1.36.1 however optimizes this declaration into nothing. > // Thus, if some other file contained `extern const int ci;' > // that other file would fail to link. > > const int ci = 99; > >Now, now, I am disappointed :-) about rfg not reading one of my previous >fundamental and world enlightening contributions (:-> :-> :->): ... Sorry Peter. I'll pay closer attention from now on. :-) Anyway, many people have now corrected me regarding the C++ default linkage for const objects. Now I only wish that I understood why my postings to gnu.g++.bug are getting automatically cross posted to comp.lang.c++. I wish that this were not the case because it just means that my ignorance becomes obvious to more people this way. :-) // rfg