I'm developing a renderer in C++ and often find debugging with a debugger cumbersome. It requires setting breakpoints, navigating through the code, and can get pretty cluttered. Instead, I've been using print statements to debug (like std::print), but it turns into a messy process where I have to go back and add checks, often resulting in commented-out code everywhere. Is there a more organized way to handle logging or debugging that keeps things clean and controlled?
3 Answers
Don't forget about conditional breakpoints! They can be set up to log instead of breaking the flow. This way, you capture relevant information without cluttering your code with print statements. It's super handy to log specifics like function calls, parameters, and return values based on certain conditions, which keeps it all tidy.
If you’re serious about coding, definitely invest some time in learning the debugger. It’s a powerful tool and having that knowledge will save you a lot of headaches down the line.
Honestly, mastering the debugger is your best bet. Learn to use it effectively—don’t just plop random breakpoints everywhere. Instead, focus on the areas where you suspect issues might arise. Also, use the watch functionality to keep an eye on variable values without constantly printing them. Print statements can just end up being messy. It’s like the shortcut that becomes a hassle later on.

I get where you're coming from, but I think both methods have their place. Sometimes, interactive debugging isn’t enough, and a log lets you easily skim through events. It’s like having a bird’s-eye view of what’s happening without restarting your session every time you miss something. Just remember to be deliberate with what and how you log.