The other day my coworker Gamini asked me if there were a C++ exception handling mechanism to “continue” from where the exception was thrown. I thought I remembered some obsure keyword… wrong, C++ exception handling follows a “termination model”, the stack is unwound as you go, the damage is done before you hit the exception handler, and there’s no going back. In this case, there are some other languages (Smalltalk, Lisp) that do a better job than C++, by providing a “resumption model” of exception handling. When an exception is thrown, these languages walk back up the stack without destroying it, or preserve it in some other way, so that a “resume” is possible if the exception is “tolerable” (after you log the condition or take some other moderate action). Wikipedia has a good discussion. And of course boost peoples have an even livelier one, as expected. :>

Leave a Reply