slide 1 slide 2 slide 3 Short Example
Debugging is what you do to fix your program when it doesn't work. [As opposed to what you do when it does not compile. -- 20 May 1996] The term originated with the first tube computers. Sadly debugging has always been a part of computer programming. Modern programming techniques try to reduce or eliminate the need for extensive debugging of code, by preparing logically perfect programs.
When you come to debug your program, you already know it doesn't work. If you knew before that it didn't work then you could correct it before you began. If you understand your program you will be less likely to make mistakes and be better at correcting them. Write the program so you can understand it. Use comments and simple code.
If your program is clear you can make it correct. Can you be sure your program is correct if it isn't clear?
stderr
#ifdef DEBUG fprintf(stderr, "top of main loop k= %d\n",k); #endif
#define DEBUG
before the #ifdef
#if DEBUG > 1
)
List of Contents short example
Last updated by J. Blustein on 28 May 1996.
This document is copyright by its author, J. Blustein <jamie@csd.uwo.ca>.