|Ned Batchelder : Blog | Code | Text | Site|
Destructors instead of catches
» Home : Blog : February 2004
One of the most powerful features of C++ is that stack objects are guaranteed to be destroyed as functions are exited, regardless of why they were exited (normal return, or an exception being thrown). This is one of those clever techniques that is easy to know about, but then easy to overlook anyway (as I recently did). I've written an article about it: Destructors instead of catches.