Exception handling in C++ without language extension
R.S.K. Wong, EDWARD K. N. YUNG · 2002
A short description of the concept of an exception is given. A method is proposed for exception handling in C++ without language extension. The method proposed is possible due to the clean-up action (so-called destructors) in the process of stack unwinding at the time when an exception is raised. The method has been implemented and tested on several compilers and on various platforms, including Zortech C++ (MS-DOS), Borland C++ (MS-DOS) and AT&T C++ (SunOS). Finally, the limitations of the proposed method are addressed. A comparison of this method with the exception handling mechanism used in AT&T C++ version 2.1 is given to show why language extension is the preferable approach to handle exceptions. The program given is a good example for learning C++, since nearly all important C++ features (such as inheritance, operator overloading, virtual functions, etc.) are utilized in the program in an innovative manner.>