EH has been included in most modern languages since C++ since their
utility greatly improves reliability
Here, we look at PL/I, Ada, C++ and Java and briefly consider
Events as a special form of exception
design issues:
PL/I
Built-in exceptions all have built-in handlers but can be overridden by userdefined handlers
you can enable or disable conditions (some default to being disabled)
(NO condition) : statement; or
(condition) : statement;
Continuation can be
a branch (using GO TO)
continue with the same or next instr.
termination of program
General form:
ON condition [SNAP]
BEGIN;
END;
PL/I Examples
In the example below, handlers for
Endfile are provided for two different files
Ada Example
exception
when End_Error =>
Put(Limits Frequency);
for Index in 0..9 loop
Limit_1 := 10 * Index;
Limit_2 := Limit_1 + 9;
if Index = 9 then
Limit_2 := 100;
end if;
Put(Limit_1);
Put(Limit_2);
Put(Freq(Index+1));
New_Line;
end loop;
end Grade_Distribution;