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 lucon dot org (H.J. Lu)
- Subject: Re: p2736.C Is dtor order guaranteed?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 21 Jul 1998 17:06:01 -0700
- Cc: egcs at cygnus dot com
- References: <m0yymAh-00038iC@ocean.lucon.org>
>>>>> H J Lu <hjl@lucon.org> writes:
>> > One way to fix all these is
>>
>> > 1. egcs reserves a slot on __DTOR_LIST__ for the destructor of the
>> > local static variable. We can mark it as -1 so that
>> > __do_global_dtors_aux won't run it.
>> > 2. Put an auxiliary constructor of the local static variable on
>> > _CTOR_LIST__ to record some information for the real constructor.
>> > 3. The real constructor of the local static variable will put the
>> > destructor in the reserved slot on __DTOR_LIST__ and rearrange
>> > the order of __DTOR_LIST__ if necessary.
>>
>> But that doesn't handle the atexit problem. The idea of rearranging
>> __DTOR_LIST__ is also a bit dodgy.
> The problem is we cannot use atexit to register the destructor of
> the local static variable.
Did you not see the rest of my message, where I said that functions
registered with atexit must be run along with the destructors, in the
appropriate order?
Jason