Namespaces
Variants
Views
Actions

Error handling

From cppreference.com
< cpp
Revision as of 13:11, 9 August 2011 by P12 (Talk | contribs)

Template:cpp/error/sidebar

Contents

Exceptions

The class exception provides a common interface to signal for error conditions through the throw expression.

Exception categories

Several convenience classes are predefined 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.

Error numbers

Several macros are available, that provide POSIX error number support. An errno variable is also supported, a separate value is given to each thread.Template:mark c++11 feature

Assertions

Assertions help to implement checking of preconditions in programs.

Defined in header <cassert>
aborts the program if the user-specified condition is not Template:cpp. May be disabled for release builds
(function macro)

static_assert declaration renders the program ill-formed if the user-specified condition is not Template:cpp Template:mark c++11 feature.

System error