• DocumentCode
    2037408
  • Title

    Exception handling in C++ without language extension

  • Author

    Wong, R.S.K. ; Yung, E.K.N.

  • Author_Institution
    Dept. of Electron. Eng., City Polytech. of Hong Kong, Kowloon, Hong Kong
  • Volume
    1
  • fYear
    1993
  • fDate
    19-21 Oct. 1993
  • Firstpage
    411
  • Abstract
    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.<>
  • Keywords
    C language; C listings; error handling; exception handling; inheritance; object-oriented languages; program compilers; AT&T C++ version 2.1; Borland C++; MS-DOS; SunOS; Zortech C++; clean-up action; compilers; destructors; exception handling; inheritance; language extension; operator overloading; stack unwinding; virtual functions; Automatic control; Computer languages; Embedded system; Error correction; Libraries; Programming profession; Scattering; Tiles; Writing;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    TENCON '93. Proceedings. Computer, Communication, Control and Power Engineering.1993 IEEE Region 10 Conference on
  • Conference_Location
    Beijing, China
  • Print_ISBN
    0-7803-1233-3
  • Type

    conf

  • DOI
    10.1109/TENCON.1993.320014
  • Filename
    320014