668 Chapter 14 Exception Handling and Event Handling
catch(float) {... }
...
}
}
class Small {
int j;
float g;
void fun2() throw float {
...
try {
...
try {
Big.fun1();
...
throw j;
...
throw g;
...
}
catch(int) {... }
...
}
catch(float) {... }
}
}
In each of the four throw statements, where is the exception handled?
Note that fun1 is called from fun2 in class Small.
- Write a detailed comparison of the exception-handling capabilities of
C++ and those of Java. - With the help of a book on ML, write a detailed comparison of the
exception-handling capabilities of ML and those of Java. - Summarize the arguments in favor of the termination and resumption
models of continuation.
PROGRAMMING EXERCISES
- Write an Ada code segment that retries a call to a procedure, Tape_Read,
that reads input from a tape drive and can raise the Tape_Read_Error
exception. - Suppose you are writing a C++ function that has three alternative
approaches for accomplishing its requirements. Write a skeletal version
of this function so that if the first alternative raises any exception, the