-
Book Overview & Buying
-
Table Of Contents
Modern C++ Programming Cookbook - Second Edition
By :
Exception specification is a language feature that can enable performance improvements, but on the other hand, when done incorrectly, it can abnormally terminate the program. The exception specification from C++03, which allowed you to indicate what types of exceptions a function could throw, has been deprecated and replaced with the new C++11 noexcept specification. This specification only allows you to indicate that a function does not throw exceptions, but not the actual exceptions types that it throws. This recipe provides information about the modern exception specifications in C++, as well as guidelines on when to use them.
Use the following constructs to specify or query exception specifications:
nothrow in a function declaration to indicate that the function is not throwing any exception:
void func_no_throw() noexcept
{
}
nothrow(expr) in a function declaration...