You can make your programs easier to debug by following the simple
guidelines outlined in this topic.
- Do not hand-tune your source code for performance until you have fully
debugged and tested the untuned version. Hand-tuning might make the logic
of your code harder to understand.
- Do not hand-tune source code that is the output of an automated tool.
- Where possible, do not put multiple statements on a single line, because
some debugger features operate on a line basis. For example, you cannot step
over or set line breakpoints on more than one statement on the same line.
- Assign intermediate expression values to temporary variables to make it
easier to verify intermediate results by monitoring the temporary variables.
To debug programs at the level of source code statements, you must
specify the compiler options that generate debug information. In some cases,
you must specify additional options that enable the debug engine to work properly
with your code. Some compilers provide the capability to generate line-only debug
information. This option can dramatically shrink the size of the resulting
executable. If this option is selected, the debugger will be able to show
you where you are in the program, but it will be unable to show you the values
of any variables. This option is useful when debugging optimized code, where
the values of variables cannot be reliably displayed anyway.