p2736.C Is dtor order guaranteed?
Jason Merrill
jason@cygnus.com
Tue Jul 21 17:06:00 GMT 1998
>>>>> 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
More information about the Gcc
mailing list