This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: p2736.C Is dtor order guaranteed?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]