News for hackers. Stuff that matters.
Re:Productive Programming by vilya on Wednesday September 01, 2010 @07:33AM (#1652448)
I disagree with almost every sentence in your post, but there's one bit in particular I wanted to focus on:

> The big advantage of printf as a debug technique is that it doesn't work unless you understand what you're doing.

This isn't true, nor would it be an advantage if it were.

Any fool can stick a printf statement into their code, just like any fool can run it in a debugger. You might get lucky and find the problem, or you might not. Understanding what you're doing will help you out whichever technique you use. Better yet, it will help you decide which technique is more appropriate to the problem.

Re:Productive Programming by anamax on Wednesday September 01, 2010 @02:33PM (#1653718)
> Any fool can stick a printf statement into their code, just like any fool can run it in a debugger. You might get lucky and find the problem

That's like saying that you might get lucky if you make random changes to program code. Yes, it's true, but ....

> Understanding what you're doing will help you out whichever technique you use. Better yet, it will help you decide which technique is more appropriate to the problem.

Except that I was talking about understanding the program, not "what you're doing".

In my experience, debuggers let me find things, or, more often, think that I'm doing something useful, with less understanding than printf. YMMV.