From 8046374633999700583
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,deec59fd1ee296e8
X-Google-Attributes: gidf78e5,public
From: tony@online.tmx.com.au (Tony Cook)
Subject: Re: init of static objects
Date: 1995/06/05
Message-ID: <D9q2Eq.8JL@online.tmx.com.au>#1/1
X-Deja-AN: 103925192
references: <dent-2505952315070001@adsoftware.highway1.com.au> <3q2cig$81a@engnews2.Eng.Sun.COM> <3q550m$b02@vishnu.jussieu.fr> <D9DB5C.JGA@ucc.su.OZ.AU>
organization: Home
newsgroups: comp.std.c++

John Max Skaller (maxtal@Physics.usyd.edu.au) wrote:
: In article <3q550m$b02@vishnu.jussieu.fr>,
: Fabrice Clerc <clerc@gla.ecoledoc.ibp.fr> wrote:

: Note that a global registry object is VERY DANGEROUS.
: There is no way to ensure it is initialised before it is needed.

: A work around is to use a _pointer_ to such an object,
: and have each class registering itself check of the pointer
: is 0, and if so create the object.
: Getting rid of the object is then kind of tricky -- I think
: it requires using "atexit()".

Or a static local variable in a function which returns the address
of (or a reference to) the object.

-- 
        Tony Cook - tony@online.tmx.com.au
                    100237.3425@compuserve.com



