Table of Contents

Exceptions

Handling

The <exception> header provides functions and classes for exception control. One basic class is exception:

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

Standard Exceptions

The <stdexcept> header provides a small hierarchy of exception classes that can be thrown or caught:

Logic errors are thrown if the program has internal errors that are caused by the user of a function and that, in theory, are preventable.
Runtime errors are thrown if the cause is beyond the program and can't be predicted by the user of a function.