Debug information can be displayed on the screen, in a file, in a separate window, or through other reporting means. A computer that is starting up, for example, uses something called POST (power on self-test) and makes a series of beeps that tell the user which POST tests have been successfully executed.
Let’s assume that you want to supply a flag in the following format:
From here, you need to perform some actions to identify and process the flag:
Introduce a global runtime variable to contain the debug status.
Ensure that debug behavior statements are executed selectively.
Process the command line for the -debug flag.
These are very straightforward steps, with a few caveats that I’ll cover in Chapters 10 ...