Article View: comp.lang.c++.moderated
Article #76Re: static members as members of a metaclass h
From: Randal Parsons
Date: Fri, 12 Apr 1996 19:53
Date: Fri, 12 Apr 1996 19:53
40 lines
2487 bytes
2487 bytes
[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 ]
Technical Details
Message-ID:
<pgpmoose.199604121252.25489@isolde.mti.sgi.com>Path:
arc1-ca.pugleaf.net!fido.asd.sgi.com!austernReferences:
<4jc5lt$doh@arl-news-svc-2.compuserve.com> <4jckdc$ad6@engnews1.Eng.Sun.COM> <kywx3q1nox.fsf@gator.mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern From: Randal Parsons <Randal.Parsons@btal.com.au> Newsgroups: comp.lang.c++.moderated,comp.std.c++ Subject: Re: static members as members of a metaclass h Followup-To: comp.lang.c++.moderated Date: 12 Apr 1996 19:53:58 GMT Organization: Bankers Trust Australia Limited. Approved: austern@isolde.mti.sgi.com,vandevod@cs.rpi.edu Message-ID: <pgpmoose.199604121252.25489@isolde.mti.sgi.com> References: <4jc5lt$doh@arl-news-svc-2.compuserve.com> <4jckdc$ad6@engnews1.Eng.Sun.COM> <kywx3q1nox.fsf@gator.mit.edu> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: Thu, 11 Apr 1996 15:21:46 +1100 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMW60kky4NqrwXLNJAQFk6QH+K7MCc4svYS71IXJiIoKIFQCk8pc8kqn8 bcSb1glljlCPStEDRNwTKkzFI7jAsgKJuNQrPZUp2SKEM3oJORW5Zw== =RqUi Originator: austern@isolde.mti.sgi.com