exception — Exception handling

The exception header file defines several types and functions related to the handling of exceptions.

namespace std {
    class exception;
    class bad_exception;
    typedef void (*terminate_handler)();
    typedef void (*unexpected_handler)();
    terminate_handler
        set_terminate(terminate_handler ph) throw();
    unexpected_handler
        set_unexpected(unexpected_handler ph) throw();
    void terminate();
    void unexpected();
    bool uncaught_exception();
    };

bad_exception

class bad_exception : public exception {
    };

The class describes an exception that can be thrown from an unexpected handler. The value returned by what() is an implementation-defined C string. None of the member functions throw any exceptions.

exception

class exception {
public:
    exception() throw();
    exception(const exception& rhs) throw();
    exception& operator=(const exception& rhs) throw();
    virtual ~exception() throw();
    virtual const char *what() const throw();
    };

The class serves as the base class for all exceptions thrown by certain expressions and by the Standard C++ library. The C string value returned by what() is left unspecified by the default constructor, but may be defined by the constructors for certain derived classes as an implementation-defined C string. None of the member functions throw any exceptions.

terminate_handler

typedef void (*terminate_handler)();

The type describes a pointer to a function suitable for use as a terminate handler.

unexpected_handler

typedef void (*unexpected_handler)();

The type describes a pointer to a function suitable for use as an unexpected handler.