In ILE, the effect of the set_terminate() function is scoped to an
activation group. The following figure provides an example of how this
can affect the compilation of code that is ported from a non-ILE
platform.
Figure 232. Example of Code Ported to ILE that Results in an Uncaught Exception
// File main.c #include <stdio.h> #include <stdlib.h> #include <iostream.h> #include <terminat.h> void a(); void my_terminate(); int main() {(2) set_terminate(my_terminate); try { a(); } catch(...) cout << "failed" << endl; } // File term.c(1) #include <stdio.h> #include <stdlib.h> #include <iostream.h> void my_terminate() { cout << "failed" << endl; } void a() { throw 7; }(3) |
In Figure 232:
As a result, a CEE9901 error message is sent to main().
When you port code from another platform to ILE, you need to ensure that the following functions run in the same activation group:
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.