Exception specifications

Exception specifications are deprecated in C++11 but you may see them in earlier code. A specification is through the throw expression applied to a function declaration giving the exceptions that can be thrown from the function. The throw specification can be an ellipsis, which means that the function can throw exceptions but the type is not specified. If the specification is empty then it means the function won't throw exceptions, and this is the same as using the noexcept specifier in C++11.

The noexcept specifier tells the compiler that exception handling is not required, so if an exception does occur in the function the exception will not be bubbled out of the function and the terminate function will be called immediately. In this situation, there is no guarantee that the destructors of the automatic objects are called.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset