From -6630877857510930486
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,b6b75bc18fef8cc7
X-Google-Attributes: gidf78e5,public
X-Google-Thread: fc772,d7d2bda46666f438,start
X-Google-Attributes: gidfc772,public
From: Randal Parsons <Randal.Parsons@btal.com.au>
Subject: Re: static members as members of a metaclass h
Date: 1996/04/12
Message-ID: <pgpmoose.199604121252.25489@isolde.mti.sgi.com>#1/1
X-Deja-AN: 147173930
references: <4jc5lt$doh@arl-news-svc-2.compuserve.com> <4jckdc$ad6@engnews1.Eng.Sun.COM> <kywx3q1nox.fsf@gator.mit.edu>
x-original-date: Thu, 11 Apr 1996 15:21:46 +1100
followup-to: comp.lang.c++.moderated
organization: Bankers Trust Australia Limited.
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.lang.c++.moderated,comp.std.c++
originator: austern@isolde.mti.sgi.com

[c.s.c++ moderator's note: This thread has drifted away from the issue
of how the C++ standard should address initialization of global static
data.  I suggest that further discussion be conducted in
comp.lang.c++.moderated.  mha]

Jeffrey C. Gealow wrote:

In article <4jckdc$ad6@engnews1.Eng.Sun.COM> clamage@Eng.Sun.COM
(Steve Clamage) writes:

   I believe a reasonable solution to the problem of initialization of
   non-local static data is not to use non-local static data!

   Instead of a static data object or static class data member, use a
   function with a local static object.

But this adds the overhead of the function call mechanism to every use
of the object.


This may not be appropriate for this forum, but I have also found that
it will cause the heap to be corrupted if such a function is called in
a driver DLL under Win NT 3.51 and VC 4.0, although I have no idea
why.  Global statics don't seem to have the same limitation.

Regards,

Randal.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]

      [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
      [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
      [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
      [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]





