| Debugging C and C++ code in a Unix environment | ||
|---|---|---|
| Prev | Chapter 3. Aspects of debugging C and C++ code | Next |
Try to prevent bugs by analysing the problem before and by designing good program structures. However, it is always possible that a program contains a number of bugs. To find these bugs the following methods exist:
always be aware of the RTFM technique
use the possibilities of warnings the compiler can give you
using a debugging tool (ddd or gdb) is advisable above `printf() debugging'
add assertions at critical places of your program
use Electric Fence (or an other memory allocation debugging tool) to find problems with pointers and array bounds