A flowgraph is concerned only with the patterns of flow of control within a subprogram and not with the reasons why control leaves it. The final consideration is a subprogram which not only may raise an exception, but will also contain an exception handler for it. To illustrate this situation a flowgraph for the GetValidPurchasePrice subprogram introduced to illustrate exception handling in Section 2 Chapter 3 will be developed. The implementation of this subprogram, whose design was given in Section 2 Chapter 3, is as follows. The corresponding flowgraph for this procedure is as follows.
All flow of control enters the graph at node a and leaves at node h .
The arc between a and b represents the declaration and initialisation of the local variables, the arc between b and h the statement on line 0032 which exports the obtained value. The main loop is represented by the flowgraph which connects node b with itself. Node c represents the begin on line 0008 and node i the end on line 0030 through which all paths must pass. Node d represents the GET statement on line 0011, node e the if on line 0012 and the arc between e and g the flow of control which does not execute the body of the if . If an exception is raised by the GET procedure at line 0011 then flow of control will pass from node d to nodes f 1 i b .