Difference between revisions of "cpp/error"
From cppreference.com
< cpp
m (+couple dcl list items) |
m (Text replace - "{{cpp|" to "{{c|") |
||
Line 62: | Line 62: | ||
{{dcl list keyword | cpp/keywords/static_assert| notes={{mark c++11}}}} | {{dcl list keyword | cpp/keywords/static_assert| notes={{mark c++11}}}} | ||
{{dcl list header | cassert}} | {{dcl list header | cassert}} | ||
− | {{dcl list macro fun | cpp/error/assert | aborts the program if the user-specified condition is not {{ | + | {{dcl list macro fun | cpp/error/assert | aborts the program if the user-specified condition is not {{c|true}}. May be disabled for release builds}} |
{{dcl list end}} | {{dcl list end}} | ||
===System error=== | ===System error=== | ||
− | The header {{tt|<system_error>}} defines types and functions used to report error conditions originating from the operating system, streams I/O, {{ | + | The header {{tt|<system_error>}} defines types and functions used to report error conditions originating from the operating system, streams I/O, {{c|std::future}}, or other low-level APIs. |
{{dcl list begin}} | {{dcl list begin}} |
Revision as of 18:55, 19 April 2012
Contents |
Exception handling
The header <exception>
provide several classes and functions related to exception handling in C++ programs.
Exception categories
Several convenience classes are predefined in the header <stdexcept>
to report particular error conditions. These classes can be divided into two categories: logic errors and runtime errors. Logic errors are a consequence of faulty logic within the program and may be preventable. Runtime errors are due to events beyond the scope of the program and can not be easily predicted.
Defined in header
<stdexcept> | |
exception class to indicate violations of logical preconditions or class invariants (class) | |
exception class to report invalid arguments (class) | |
exception class to report domain errors (class) | |
exception class to report attempts to exceed maximum allowed size (class) | |
exception class to report arguments outside of expected range (class) | |
exception class to indicate conditions only detectable at run time (class) | |
exception class to report range errors in internal computations (class) | |
exception class to report arithmetic overflows (class) | |
exception class to report arithmetic underflows (class) |
Error numbers
Defined in header
<cerrno> |
Assertions
Assertions help to implement checking of preconditions in programs.
Defined in header
<cassert> | |
aborts the program if the user-specified condition is not true. May be disabled for release builds (function macro) |
System error
The header <system_error>
defines types and functions used to report error conditions originating from the operating system, streams I/O, std::future, or other low-level APIs.