> This kind of code is BAD.
> For this reason:
> ====================
> void somefunction() {
> do_something();
> if (do_something_else())
> return; //Whoopsie!
✂ ✂ ✂ ✂ ✂
That isn't the example code I provided, at all. You've injected a return which I did not have in my code. My code, as written, will (in C) guarantee the last line to be executed if the process has not been terminated. Exceptions in C++ prevent you from making the same assertion, which is why you need RAII and/or
> If you use smart pointers it's even nicer:
stuff like smart pointers.
There's a good overview of using smart pointers and other techniques to ensure deterministic resource management here: