Topic: Why aren't there not-necessarily-unwinding exceptions a la VMS?


Author: "Daniel S. Barclay" <daniel@compass-da.com>
Date: 1995/09/19
Raw View
In the design of exceptions and exception handling, has the language
design committee (or implementors or whoever) reviewed VAX/VMS exception
handling and its capabilities?

I've noticed one thing that the C++ draft's exception mechanism does not
(seem to) support that VAX/VMS supports (or at least used to; I haven't used
VMS for 6 years).

In VMS exception handling, the stack is not unwound before traversing upwards
to find the applicable exception handler.  The handler gets control first,
and can decide whether to unwind and handle the exception, to pass control up
to the next handler, or to continue execution of the code that raised (threw)
the exception.

The main result is that you can throw a warning exception and then continue
(if the called handler decides to continue).  Additionally, you can throw an
exception, and the called handler can decide whether to consider it an error
and unwind or just a warning and continue.

(If I recall correctly, VMS used this for reporting warnings:  A called
routine would raise a warning exception (VMS encoded the severity in the
integer exception number), and normally the default exception handler would
print the warning and continue execution.  The programmer could insert an
exception handler to suppress the warnings, to treat them as errors instead,
or whatever.)

Has this been considered for C++?

If yes, why was it rejected?  (I'm curious.  Did it clash with something
else?  Are there implementation problems?  Does C++ already provide that
functionality?)

If no, could someone please refer the committee to VMS exception handling
so they can consider whether the capability described above fits in C++?


Thanks,
Daniel

[Moderator's note: There's some discussion of why C++'s exceptions
were designed the way they were in The Design and Evolution of C++.
mha.]

---
[ 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. ]