7b - Exception handling semantics. In this section, we summarize the I/0 error handling features of recent versions of Fortran, C++. and Ada. This treatment provides a convenient prelude to section , which covers the more general topic of exception handling semantics. | Programming Languages 2nd edition Tucker and Noonan Chapter 7 Semantics Ismael: “Surely all this is not without meaning.” Herman Melville, Moby Dick Contents Motivation Expression Semantics Program State Assignment Semantics Control Flow Semantics Input/Output Semantics Exception Handling Semantics Purpose Simplify programming Make applications more robust. What does robust mean? (* Pascal - what can go wrong *) reset(file, name); (* open *) sum := ; count := 0; while (not eof(file)) do begin read(file, number); sum := sum + number; count := count + 1; end; ave := sum / count; Exception Handling Figure #include int main () { char A[10]; cin >> n; try { for (int i=0; i9) throw "array index error"; A[i]=getchar(); } } catch (char* s) { cout int main () { char A[10]; cin >> n; try { for (int i=0; i9) throw "array index error"; A[i]=getchar(); } } catch (char* s) { cout int main () { char A[10]; cin >> n; try { for (int i=0; i9) throw "array index error"; A[i]=getchar(); } } catch (char* s) { cout << "Exception: " << s << endl; } return 0; } Java Exception Type Hierarchy Figure Creating a New Exception Class Missing Argument Exception Invalid Input Exception Figure StackUnderflowException Class Figure Throwing an Exception Figure AssertException Class Assert Class Figure Using Asserts