# exception

Go to the documentation of this file.

    00001 // Exception Handling support header for -*- C++ -*-
    00002
    00003 // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002
    00004 // Free Software Foundation
    00005 //
    00006 // This file is part of GNU CC.
    00007 //
    00008 // GNU CC is free software; you can redistribute it and/or modify
    00009 // it under the terms of the GNU General Public License as published by
    00010 // the Free Software Foundation; either version 2, or (at your option)
    00011 // any later version.
    00012 //
    00013 // GNU CC is distributed in the hope that it will be useful,
    00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00016 // GNU General Public License for more details.
    00017 //
    00018 // You should have received a copy of the GNU General Public License
    00019 // along with GNU CC; see the file COPYING.  If not, write to
    00020 // the Free Software Foundation, 59 Temple Place - Suite 330,
    00021 // Boston, MA 02111-1307, USA.
    00022
    00023 // As a special exception, you may use this file as part of a free software
    00024 // library without restriction.  Specifically, if other files instantiate
    00025 // templates or use macros or inline functions from this file, or you compile
    00026 // this file and link it with other files to produce an executable, this
    00027 // file does not by itself cause the resulting executable to be covered by
    00028 // the GNU General Public License.  This exception does not however
    00029 // invalidate any other reasons why the executable file might be covered by
    00030 // the GNU General Public License.
    00031
    00037 #ifndef __EXCEPTION__
    00038 #define __EXCEPTION__
    00039
    00040 extern "C++" {
    00041
    00042 namespace std
    00043 {
    00052   class exception
    00053   {
    00054   public:
    00055     exception() throw() { }
    00056     virtual ~exception() throw();
    00059     virtual const char* what() const throw();
    00060   };
    00061
    00064   class bad_exception : public exception
    00065   {
    00066   public:
    00067     bad_exception() throw() { }
    00068     // This declaration is not useless:
    00069     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
    00070     virtual ~bad_exception() throw();
    00071   };
    00072
    00074   typedef void (*terminate_handler) ();
    00076   typedef void (*unexpected_handler) ();
    00077
    00079   terminate_handler set_terminate(terminate_handler) throw();
    00082   void terminate() __attribute__ ((__noreturn__));
    00083
    00085   unexpected_handler set_unexpected(unexpected_handler) throw();
    00088   void unexpected() __attribute__ ((__noreturn__));
    00089
    00100   bool uncaught_exception() throw();
    00101 } // namespace std
    00102
    00103 namespace __gnu_cxx
    00104 {
    00113   void __verbose_terminate_handler ();
    00114 } // namespace __gnu_cxx
    00115
    00116 } // extern "C++"
    00117
    00118 #endif