Hacker News new | ask | show | jobs
by necrotic_comp 1884 days ago
There are a few languages where print debugging isn't as fast, but that always requires a ton of tooling. I found that debugging Java using Eclipse or Intellij was faster than printing, as I could introspect state and change values while the process was running. Similarly, some scripting environments I've used have allowed for robust state and flow analytics.

But in a normal environment ? or using C++ ? It's generally quicker (though much dirtier) to find simple bugs using print statements to track down assumptions ; when you're in the weeds with a complicated problem or need to track down a crash, then yes, bring out the big guns. But for normal development, I don't think it's completely necessary.

1 comments

Debugging in C++, is a bit of a pain sometimes. GDB tools are good paired with an IDE like VSCode, but due to the abstractions in C++, inspecting variables require verbose code - beyond the convenience of debugging in a higher level language like Python or even Java as you suggested.

Eg: tracking the values of a std::vector isn't obvious, since there is std:begin and std::end iterators in the vector namespace and you have to manually dereference the whole range in the debugger.

I don't know any ide which doesn't display an std::vector as an array in their gui
It could be I may be missing a plugin. Which IDE do you use?