Specifications
Error Handling
3-13
3
Error Handling Example
The following example describes the default error handling for a console
application. In the example program,
test.c, assume that the function
libFuncB() represents a library function such as ipl?AddS(), and the
function
libFuncD() represents a function that is called internally to the
library. In this scenario,
main() and appFuncA() represent application
code.
Thevalueoftheerrormodeissetto
IPL_ErrModeParent.The
IPL_ErrModeParent option produces a more detailed account of the error
conditions.
Example 3-1 Error Functions
/* application main function */
main() {
iplSetErrMode(IPL_ErrModeParent);
appFuncA(5, 45, 1.0);
if (IPL_ERRCHK("main","compute something")) exit(1);
return 0;
}
/* application subroutine */
void appFuncA(int order1, int order2, double a) {
libFuncB(a, order1);
if (IPL_ERRCHK("appFuncA","compute using order1")) return;
libFuncB(a, order2);
if (IPL_ERRCHK("appFuncA","compute using order2")) return;
}
/* do some more work */
continued ☞
☞☞
☞