This is the mail archive of the gcc-bugs@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: C++ destructor not called?


>>>>> 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


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