errchk list of procedure namesWhen an error occurs in a procedure whose name is listed in an errchk statement, program execution in the calling procedure jumps to the return statement. Thus the rest of the code in the calling procedure is skipped. By including errchk statements in all of the routines between the procedure with the iferr block and the procedure which contains the error() call, program execution will return to the iferr block without executing any intervening code if the error() procedure is called. Example 3.4 shows the use of the errchk statement. The lowest level procedure, gtdist, computes the distance between two points. If this distance is zero, it calls the error() procedure. The intermediate level procedure, gtinv, computes the inverse of the distance. To prevent the procedure from trying to compute the inverse of zero, the procedure contains an errchk statement for gtdist. This causes the execution of the program to skip this statement and return to the iferr block in gtline.
Generated with CERN WebMaker