Why use
printf() to
debug, asks
-brazil-, if you've got a real
debugger?
- Some programs are unrunnable sans optimization. They just take too long. And debugging information either doesn't exist with optimization, or is plain confusing (optimization mixes different source code lines).
- Some bugs don't show up when you compile with different options. Pointer bugs especially fall into this category.
- You can leave debugging printfs (suitably #ifdef'ed out) in place for the next time. An interactive session goes away when you type `quit'.
- Sometimes it takes several hours to get to the buggy place. printf() debugging is batch debugging.
I'll give up printf() when you pry my cold dead fingers from it!