home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13262 < prev    next >
Encoding:
Text File  |  1992-09-03  |  1.1 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: External or internal linkage according to ARM?
  5. Message-ID: <1992Sep3.174022.14512@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <WARSAW.92Sep2153003@anthem.nlm.nih.gov>
  8. Date: Thu, 3 Sep 1992 17:40:22 GMT
  9. Lines: 29
  10.  
  11. warsaw@nlm.nih.gov (Barry A. Warsaw) writes:
  12.  
  13. |In the following example, should the symbol Singleton::OnlyOne have
  14. |external linkage or internal linkage?  Cfront 2.1 say external, but
  15. |g++ 2.2.2 gives only internal and the question of which is correct has
  16. |come up.
  17.  
  18. |class Singleton
  19. |{
  20. |public:
  21. |    static const Singleton& const OnlyOne;
  22. |    ...
  23. |};
  24.  
  25. ARM section 9.4, first paragraph:
  26.  
  27. "Static members of a global class have external linkage."
  28.  
  29. Even without this explicit sentence, the semantics of static members
  30. require global linkage.  (There is only one copy shared by all class
  31. instances.)
  32.  
  33. Local classes cannot have static data members (also in 9.4) for
  34. the same reason: there is no way to to provide a definition of
  35. the static data member.
  36. -- 
  37.  
  38. Steve Clamage, TauMetric Corp, steve@taumet.com
  39. Vice Chair, ANSI C++ Committee, X3J16
  40.