3 ms·
While I can see the argument for and against printf, with the cpu and memory profiling tools, you can basically figure out where most of the issues in your code
by enahs-sf 11y ago
While I can see the argument for and against printf, with the cpu and memory profiling tools, you can basically figure out where most of the issues in your code are. I'd say for most applications, logging, printf, etc. can get you 80% of the way there. Profiling gets you another 10%. For those last mile apps, sorry, but you have to use GDB.
- TillE 11y agoIf you don't care how long it takes, sure, tracing with printf works. But a debugger accomplishes the same task in minutes rather than hours. Even if you know only the very basics of how to use a debugger, it's an extremely effective tool.
- ska 11y agoIt's not always effective - many developers will often save minutes of thinking by spending hours dicking about in a debugger and setting up state. But it is true that for some types of bugs a step debugger is damn handy. And for some types, mostly a distraction.