|Synopsis:||Only use exception specifications when you must constrain the set of exceptions that might be thrown from a function|
It requires careful thought to design an exception handling strategy, including the decision which interfaces will specify exceptions that might be thrown.
Beware of the consequences when an exception specification is violated! When a function throws an exception (possibly indirectly thrown by a nested function call) that does not match its specification, then the program will be usually be aborted without proper cleanup. This is almost never desirable.
Consider to use only empty exception specifications, in order to guarantee that a certain function will never throw an exception. The compiler might use this for performance optimization. If in any doubt, do not use exception specifications.
|ISC++ Rec 12.16|