User Tools

Site Tools


c_exceptions

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

===== Overview ===== Exceptions, with emphasis on C++11 enhancements. Links: * [[http://en.cppreference.com/w/cpp/language/exceptions|cppreference.com "Exceptions"]] * [[http://en.cppreference.com/w/cpp/language/throw|throw-expression]] * [[http://en.cppreference.com/w/cpp/language/try_catch|try-catch block]] * [[http://en.cppreference.com/w/cpp/language/function-try-block|function-try-block]] * [[http://en.cppreference.com/w/cpp/language/noexcept_spec|noexcept specifier]] * [[http://en.cppreference.com/w/cpp/language/noexcept|noexcept operator]] * [[http://en.cppreference.com/w/cpp/language/except_spec|Dynamic exception specification (until C++17)]] ===== Error handling possibilities ===== * Terminate the program. * Return an error value. * Return a legal value and leave the program in an "error state" (''errno''). * Call an error-handler routine. ===== Guarantees ===== C++ standard library provides one of the following guarantees for every library operation: * //basic// for all operations: The basic invariants of all objects are maintained, and no resources, such as memory, are leaked. In particular, the basic invariants of every built-in and standard-library type guarantee that you can destroy an object or assign to it after every standard-library operation (§iso.17.6.3.1). * //strong// for key operations: in addition to providing the basic guarantee, either the operation succeeds, or it has no effect. This guarantee is provided for key operations, such as ''push_back()'', single-element ''insert()'' on a list, and ''uninitialized_copy()''. * //nothrow// for some operations: in addition to providing the basic guarantee, some operations are guaranteed not to throw an exception. This guarantee is provided for a few simple operations, such as ''swap()'' of two containers and ''pop_back()''.

c_exceptions.1517569330.txt.gz · Last modified: 2018/02/02 11:02 by rpjday