News for hackers. Stuff that matters.
Re:Comparing Pythagorean triples in C++, D, and Rust by int_19h on Monday December 31, 2018 @06:55PM (#18797929)
printf debugging doesn't work when your code already crashed, and all you have is the process dump (and if you're very lucky, it's a heap dump, not just stacks).
Re:Comparing Pythagorean triples in C++, D, and Rust by ajross on Monday December 31, 2018 @07:07PM (#18797994)
That's like saying that time spent developing a robust resupply and support network is wasted because your army is already starving in Russia. It's true, but sort of misses the point.

Obviously it's possible to debug an issue based only on static state like a core dump. And in extraordinarily rare cases that might be the only available option and a debugger (or more manual tooling) might be your only choice.

But in the overwhelming majority of cases, even working at the lowest and most obtuse levels, the very first step in debugging a problem, long before anyone starts flaming about tool choices, is to come up with a reproducible test case. And once you have that, frankly, fancy tooling doesn't bring much to the table.

At the end of the day you have to spend time staring right at the code at fault and thinking about it, and if you have it up in your editor to do that, you might as well be stuffing printf's in there while you're at it.

Re:Comparing Pythagorean triples in C++, D, and Rust by int_19h on Wednesday January 02, 2019 @09:49PM (#18812418)
Those "extraordinary rare cases" aren't anywhere near as rare or extraordinary when you have millions of users.

In fact, I would argue that reproducible reports are relatively rare in the industry, especially once you get out of developer tooling (where the users are people who know the value of such reports, and how to obtain them).

And then stuffing a printf in the middle of it can easily mean several minutes of build time, for a large native codebase. A tracepoint, on the other hand, is instant.

Re:Comparing Pythagorean triples in C++, D, and Rust by Shorel on Tuesday January 01, 2019 @12:48AM (#18799127)
You can do binary search with the line where the printf statement is, and eventually you will find the line with the error.