Article View: gnu.g++.bug
Article #894Re: g++ doesn't always generate symbol defs
From: Barry A. Warsaw
Date: Thu, 03 Sep 1992 21:58
Date: Thu, 03 Sep 1992 21:58
37 lines
1664 bytes
1664 bytes
Just to support my claim that g++ botches the job by not making a
static const Foo& const member have external linkage, Steve Clamage in
comp.lang.c++ writes:
From: steve@taumet.com (Steve Clamage)
Subject: Re: External or internal linkage according to ARM?
Date: 3 Sep 92 17:40:22 GMT
warsaw@nlm.nih.gov (Barry A. Warsaw) writes:
|In the following example, should the symbol Singleton::OnlyOne have
|external linkage or internal linkage? Cfront 2.1 say external, but
|g++ 2.2.2 gives only internal and the question of which is correct has
|come up.
|class Singleton
|{
|public:
| static const Singleton& const OnlyOne;
| ...
|};
ARM section 9.4, first paragraph:
"Static members of a global class have external linkage."
Even without this explicit sentence, the semantics of static members
require global linkage. (There is only one copy shared by all class
instances.)
Local classes cannot have static data members (also in 9.4) for
the same reason: there is no way to to provide a definition of
the static data member.
--
Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Technical Details
Message-ID:
<WARSAW.92Sep3165807@anthem.nlm.nih.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!nlm.NIh.GOV!warsawReferences:
warsaw@nlm.NIh.GOV (Barry A. Warsaw)Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!nlm.NIh.GOV!warsaw From: warsaw@nlm.NIh.GOV (Barry A. Warsaw) Subject: Re: g++ doesn't always generate symbol defs Message-ID: <WARSAW.92Sep3165807@anthem.nlm.nih.gov> Sender: gnulists@ai.mit.edu Reply-To: warsaw@nlm.nih.gov (Barry A. Warsaw) Organization: Century Computing, Inc. References: warsaw@nlm.NIh.GOV (Barry A. Warsaw) Distribution: gnu Date: Thu, 3 Sep 1992 21:58:07 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 38