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?


> 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


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