C++ ABI Summary -- 5 August meeting
Matt Austern
austern at isolde.engr.sgi.com
Mon Aug 9 22:58:42 UTC 1999
Yes, the interleaving is required by the C++ standard. (We don't
currently get this right.) It's a nuisance, and I don't think there's
any good reason for it, but the requirement is quite explicit.
The relevant part of the C++ standard is section 3.6.3, paragraph 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."
What this implies to me is that atexit, and the part of the runtime
library that handles destructors for static objects, must know about
each other.
--Matt
More information about the cxx-abi-dev
mailing list