Topic: When do thrown objects get destroyed?


Author: sdouglass@armltd.co.uk (scott douglass)
Date: 1995/08/19
Raw View
[I hope I'm not bringing up something that's been discussed recently.  I
tried to post this once before and it never showed up.  Perhaps it was
accidentally moderated into oblivion.]

I just re-read clause 15 of the draft working paper (and searched the
rest) and the only near-mention of when thrown objects (exceptions) get
destroyed was in 15.1:  "The temporary persists as long as there is a
handler being executed for that exception."

I think this implies the exception object will be destroyed when a handler
for it finishes without rethrowing the exception.  I would also expect
undefined behavior if the destructor for the exception tried to rethrow
the exception (i.e. 'throw;').

The compilers I've tested seem to never destroy the exception object for a
handled exception.

Would you agree that these compilers are wrong?

Thanks for your time,
--scott
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]





Author: sdouglass@armltd.co.uk (scott douglass)
Date: 1995/08/21
Raw View
Distribution:
[I hope I'm not bringing up something that's been discussed recently.  I
tried to post this before and it never showed up.  Perhaps it was
accidentally routed into oblivion.]

I just re-read clause 15 of the draft working paper (and searched the
rest) and the only near-mention of when thrown objects (exceptions) get
destroyed was in 15.1:  "The temporary persists as long as there is a
handler being executed for that exception."

I think this implies the exception object will be destroyed when a handler
for it finishes without rethrowing the exception.  I would also expect
undefined behavior if the destructor for the exception tried to rethrow
the exception (i.e. 'throw;').

The compilers I've tested seem to never destroy the exception object for a
handled exception.

Would you agree that these compilers are wrong?

Thanks for your time,
       --scott

                 --scott



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]