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: martin at mira dot isdn dot cs dot tu-berlin dot de (Martin von Loewis), egcs at cygnus dot com
- Subject: Re: p2736.C Is dtor order guaranteed?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 22 Jul 1998 01:59:15 -0700
- References: <orbtqldta0.fsf@sunsite.dcc.unicamp.br> <199807210514.HAA06686.cygnus.egcs@mira.isdn.cs.tu-berlin.de>
>>>>> Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:
>> It doesn't, init5.C is there just to remember us that the current
>> behavior is non-conforming.
> From looking at the standard, it seems that the only acceptable
> implementation of global destructors is one that uses atexit for
> global objects as well.
> I.e., when a static namespace-scoped object has been successfully
> constructed, register a function with atexit that will destroy the
> object.
> Would such an implementation be conforming?
Well, yes and no. Yes, it would conform to the ordering restrictions.
However, an implementation is allowed to have a limit of 32 functions
registered with atexit, and we can't put that kind of limit on global
objects. We shouldn't put it on local statics either, but that is
currently the case. Also, it would make the current situation with
dynamically loaded objects even worse.
As far as I can tell, the only complete solution involves replacing atexit.
Jason