Can anyone explain Exception Specifications as used in C++ ?
The important thing to know is: exception specifications are deprecated in the next revision of C++, except for the no-throw specifier (throw()
), which is basically officially saying "don't use them".
Putting throw()
after a function means the function does not throw any exceptions. If it does anyway, the application will be terminated (probably - the unexpected handler is called), so the rest of your application can use that function knowing it will not throw an exception. This is can be handy for writing exception-safe code.
Example:
void MyFunction() throw() // does not throw any exceptions
{
/* ... */
{