4 ms·
When it comes to debugging, I'm firmly in the printf camp; I rarely prefer debuggers over printf-based debugging I'm struggling to understand this. Why would y
by mitsoz 9y ago
When it comes to debugging, I'm firmly in the printf camp; I rarely prefer debuggers over printf-based debugging
I'm struggling to understand this. Why would you ever prefer printf debugging in your local dev environment over using a debugger?
- jhbadger 9y agoLanguage and environment independent. It just works. It's like IDEs -- so many people spend so much time writing and learning IDEs specific to a language rather than just picking a standard text editor that can be used for any language on any platform.
- zdkl 9y agoYeah this. Does this thing colour parenthesis and stdlib builtins? We're good to go.
- xemdetia 9y agoThere is rarely a situation where you can't slip a printf or log message into a piece of code and observe how it's working in production. Depending on the complexity of the problem the debugger can also hide a lot of problems- is there a timing issue? is it intermittent? What happened the last 200k times? An interactive debugger technique doesn't help you at all if all you have is a coredump of an issue that happens once a month. It is definitely a personal preference, but I just find myself in too many situations where the constraints to make a debugger in a dev environment work well end up adding a lot of complexity to the problem space. I know printf/write to a file works every time, everywhere.
- AlexCoventry 9y agoI use both. They are useful in different situations. printf is lightweight, and can let you dump a lot of information very fast. It's a good approach when you're reasonably confident about what you need to know. A debugger gives you more flexibility about the questions you can ask on any particular run.