The programmer had a clever idea. He would put a bunch of code in an:
if (debugging)
statement. He would then run the program and when he wanted debugging output, he would use the interactive debugger to change debugging from 0 to 1. But his code was about to surprise him.
1 /***********************************************
2 * Code fragment to demonstrate how to use the *
3 * debugger to turn on debugging. All you *
4 * have to do is put a breakpoint on the "if" *
5 * line and change the debugging variable. *
6 ***********************************************/
7 extern void dump_variables(void);
8
9 void do_work()
10 {
11 static int debugging = 0;
12
13 if (debugging)
14 {
15 dump_variables();
16 }
17 // Do real work
18 }