home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: External or internal linkage according to ARM?
- Message-ID: <1992Sep3.174022.14512@taumet.com>
- Organization: TauMetric Corporation
- References: <WARSAW.92Sep2153003@anthem.nlm.nih.gov>
- Date: Thu, 3 Sep 1992 17:40:22 GMT
- Lines: 29
-
- 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
-