Topic: Exceptions from Destructors?


Author: kjhopps@imation.com
Date: 1997/06/09
Raw View
I'm posting again in hopes that I somehow missed replies to this
question.

I can't find anything in the CD2 that addresses specifically what is
supposed to happen in the following code when the destructors throw.
  {
    Thing* array = new Thing[N];
  }
Suppose all the destructors throw.
Will all items in the array be destroyed?
Will the memory be released?
Is it possible to write code to handle all those exceptions?

I believe the question is similar to what happens when destructors for
subobjects throw, or when derived class destructors throw.

If a derived class destructor throws, will the base class destructor be
called?
If so, how can we support the termination model of exceptions?  And what
if the base class destructor throws too?
--
Kevin J. Hopps, Imation          kjhopps@imation.com
My opinions are my own.  I speak neither for Imation nor 3M.
Support the anti-spam amendment.  See http://www.cauce.org
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]