# 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 {
    00050   class exception
    00051   {
    00052   public:
    00053     exception() throw() { }
    00054     virtual ~exception() throw();
    00057     virtual const char* what() const throw();
    00058   };
    00059
    00062   class bad_exception : public exception
    00063   {
    00064   public:
    00065     bad_exception() throw() { }
    00066     // This declaration is not useless:
    00067     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
    00068     virtual ~bad_exception() throw();
    00069   };
    00070
    00072   typedef void (*terminate_handler) ();
    00074   typedef void (*unexpected_handler) ();
    00075
    00077   terminate_handler set_terminate(terminate_handler) throw();
    00080   void terminate() __attribute__ ((__noreturn__));
    00081
    00083   unexpected_handler set_unexpected(unexpected_handler) throw();
    00086   void unexpected() __attribute__ ((__noreturn__));
    00087
    00098   bool uncaught_exception() throw();
    00099 } // namespace std
    00100
    00101 namespace __gnu_cxx
    00102 {
    00111   void __verbose_terminate_handler ();
    00112 } // namespace __gnu_cxx
    00113
    00114 } // extern "C++"
    00115
    00116 #endif