October 2011
Beginner to intermediate
1200 pages
35h 33m
English
C++ provides a syntax for specifying what exceptions, if any, a function may throw (refer to Chapter 15, “Friends, Exceptions, and More”):
void f501(int) throw(bad_dog); // can throw type bad_dog exceptionvoid f733(long long) throw(); // doesn't throw an exception
As with auto_ptr, the collective experience of the C++ programming community is that, in practice, exception specifications didn’t work as well as intended. Thus, the C++11 standard deprecates exception specifications. However, the standards committee felt that there is some value in documenting that a function does not throw an exception, and it added the keyword noexcept for this purpose:
void f875(short, short) noexcept; // doesn't throw an ...
Read now
Unlock full access