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: jason at cygnus dot com
- 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: Wed, 22 Jul 1998 18:51:01 +0200
- CC: egcs at cygnus dot com
- References: <orbtqldta0.fsf@sunsite.dcc.unicamp.br> <199807210514.HAA06686.cygnus.egcs@mira.isdn.cs.tu-berlin.de> <u990lmmfbw.fsf@yorick.cygnus.com>
> As far as I can tell, the only complete solution involves replacing atexit.
Yes, I've seen this restriction. I think that autoconf could determine
whether the system accepts at least 64 or so atexit calls; in
addition, we could make a list of systems where atexit is known to be
broken.
Alternatively, we could make a list of systems where we know that
atexit has no such restriction.
In any case, we should not too aggressively replace the atexit
implementation, as that might interfere with the native implementation
for some "C" libraries.
Also, some optimization might be applied. Given
struct X()
{
X(){ next=first;first=this; etc }
~X(){ unchain us }
}
X a;
X b;
both a and b need to be destroyed, but we could make a single call to
atexit as we know atexit won't be called between constructing a and b.
Martin