| 1 | (* Calling a nil procedure stops the program. The program ends with status 2, after the procedures registered |
| 2 | with Rt.atExit, so that what it wrote is out. *) |
| 3 | module StopNilProc; |
| 4 | import Out, Rt; |
| 5 | |
| 6 | |
| 7 | proc bye; |
| 8 | begin |
| 9 | Out.str("bye\n"); |
| 10 | end; |
| 11 | |
| 12 | proc main*; |
| 13 | var p: proc; |
| 14 | begin |
| 15 | _ := Rt.atExit(bye); |
| 16 | Out.str("before\n"); |
| 17 | p(); |
| 18 | end; |
| 19 | |
| 20 | end StopNilProc. |