This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ destructor not called?
- To: hjl at lucon dot org (H.J. Lu), egcs-bugs at cygnus dot com
- Subject: Re: C++ destructor not called?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 24 Aug 1998 15:35:33 -0700
- References: <m0zB2SH-00038xC.cygnus.egcs.bugs@ocean.lucon.org>
>>>>> H J Lu <hjl@lucon.org> writes:
> The destructor is not called on a1. Is this normal?
Yes.
-8- The function exit() has additional behavior in this International
Standard:
First, objects with static storage duration are destroyed and
functions registered by calling atexit are called. Objects with static
storage duration are destroyed in the reverse order of the completion
of their constructor. (Automatic objects are not destroyed as a result
of calling exit().)*
[Footnote: Objects with automatic storage duration are all
destroyed in a program whose function main() contains no
automatic objects and executes the call to exit(). Control can be
transferred directly to such a main() by throwing an exception
that is caught in main(). --- end foonote]
Jason