Xref: utzoo comp.lang.c++:4380 gnu.g++:342 Path: utzoo!attcan!utgpu!watmath!uunet!ginosko!usc!apple!well!nagle From: nagle@well.UUCP (John Nagle) Newsgroups: comp.lang.c++,gnu.g++ Subject: Unwinding vs destructors Keywords: throw, catch, return-from, raise, destructor Message-ID: <13145@well.UUCP> Date: 15 Aug 89 16:23:01 GMT Distribution: comp Lines: 14 C++ destructors provide a means to force cleanup of an object as it disappears upon exit from a scope. Unfortunately, the "longjmp" mechanism evades destructor processing. "longjmp" is an old hack, only sort of part of C. But it is useful. Should C++ have a better escape mechanism, along the lines of "throw" and "return-from" in Common LISP or "raise" in Ada? With those mechanisms, appropriate cleanup processing is performed as the scopes unwind. But C++ lacks such a mechanism. One could argue that such mechanisms violate the "no hidden machinery" concept of C. But C++ already has destructors, functions which are invoked by the language system, not explicitly by the user. What do people think? John Nagle