Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 11
    And don't forget that RAII is not only about memory management: there's tons of resource types you want to automatically release in the correct order, for which in C you would have to resort to the goto ladder of manual unwinding. Example of such resources: interrupt flag, mutexes, states of peripherals. A good example of what you get rid of with RAII (the goto ladder) can be seen in this function in a Linux driver. Commented Nov 2, 2019 at 11:41
  • 2
    @Ruslan of course ! I've put them in the same paragraph since both are about resource management, but the "that ...memory management" clause was for the smart pointers only. Sorry for the ambiguity. Commented Nov 2, 2019 at 11:55
  • 7
    I would add that the only thing that can avoid debugging would be a constructive mathematical proof of the algorithm and the use of certified tools and hardware. If not, then bugs are unavoidable. Commented Nov 2, 2019 at 18:09
  • I'm not sure that "you can never write bug-free code" leads to "you must use a debugger", unless you're using an extremely broad definition of the word. I've worked on platforms that had no debugger whatsoever, and had to use print statements over serial, patterns on LEDs, or even oscilloscope readouts to diagnose and fix bugs. Commented Nov 4, 2019 at 4:45
  • 1
    @MooseBoys Do you really think the OP was limiting the scope of the question to a debugger application, rather than debugging techniques in general? Commented Nov 4, 2019 at 17:07