This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: p2736.C Is dtor order guaranteed?
- To: hjl at ocean dot lucon dot org
- Subject: Re: p2736.C Is dtor order guaranteed?
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 21 Jul 1998 20:46:04 +0200
- CC: egcs at cygnus dot com
- References: <m0yyLgz-00038oC@ocean.lucon.org>
> The current implementation is wrong. We have to put the destructors
> for local static variables onto __DTOR_LIST__. Otherwise, we will also
> run into problems with dlopen/dlclose. The current scheme uses atexit.
Fine. How do you implement 3.6.3, [basic.start.term]/3, then?
>> 3 If a function is registered with atexit (see <cstdlib>, 18.3)
>> then following the call to exit, any objects with static storage
>> duration initialized prior to the registration of that function
>> shall not be destroyed until the registered function is called from
>> the termination process and has completed. For an object with
>> static storage duration constructed after a function is registered
>> with atexit, then following the call to exit, the registered
>> function is not called until the execution of the object's
>> destructor has completed. If atexit is called during the
>> construction of an object, the complete object to which it belongs
>> shall be destroyed before the registered function is called.
> It might work.
I don't think so.
Martin