🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3936

Re: static members as members of a metacla

#3936
From: Steve Clamage
Date: Sat, 06 Apr 1996 19:33
35 lines
2529 bytes
kanze@gabi-soft.fr (J. Kanze) writes:

>But the question concerned static objects in a module that was never
>referenced.  (What I'm thinking of here are objects whose constructor
>registers them with some sort of container, and that are only accessed
>via that container.  If they are constructed, they will be accessed.
>But is there any guarantee that they will eventually be constructed?)

I've been trying to use as many weasel-words as possible here, and so I
wish you wouldn't keep pointing out the holes I'm deliberately
leaving unplugged. :-)

If a non-local static object is defined in a module, but no reference
is made to anything in that module, I don't believe the static object
is guaranteed to be constructed. If any object or function in that
module is referenced from outside the module, I believe all non-local
static objects are supposed to be constructed.

The problem as I see it is the draft standard still makes some promises
which I don't believe are possible to keep in all cases (even
forgetting about dynamic libraries). I don't think we have the final
word on exactly what you can expect about order of initializtion
and destruction of non-local static objects in different modules. The
current situation is that you can't depend on the order of construction
or destruction.

--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ 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 
]
Technical Details
Message-ID: <4k2bv4$32p@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <KANZE.96Mar29114545@gabi.gabi-soft.fr> <4jp7st$lbj@engnews1.Eng.Sun.COM> <KANZE.96Apr4133331@gabi.gabi-soft.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: static members as members of a metacla
Date: 06 Apr 1996 11:33:17 PST
Organization: Sun Microsystems Inc., Mountain View, CA
Approved: austern@isolde.mti.sgi.com
Message-ID: <4k2bv4$32p@engnews1.Eng.Sun.COM>
References: <KANZE.96Mar29114545@gabi.gabi-soft.fr> <4jp7st$lbj@engnews1.Eng.Sun.COM> <KANZE.96Apr4133331@gabi.gabi-soft.fr>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 5 Apr 1996 05:44:04 GMT
X-Newsreader: NN version 6.5.0 #21 (NOV)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMWbG/ky4NqrwXLNJAQGqkgIAwXEVtGpJXPSNhtAN/S2RqincRRYF2kt/
 avSsNKFZ6jUm21bS2xpjhQtI3ktKGXpgA0MQi3BblvpWob7p+Ydr8Q==
 =QGql
Originator: austern@isolde.mti.sgi.com