This is a (to me anyway) a very difficult topic, and there are arguments both for and against. The question, if the subject line wasn't clear, is this: should you use exception specifications, or shouldn't you?

On the bright side, exception specifications provide great documentation for users of your class: they know what exceptions they need to catch. On the downside, there's a huge problem when a function with an exception specification calls another function that can possibly throw exceptions other than in the specification.

For example (example courtesy of Effective C++), if we have two functions f1 and f2:

extern void f1();                  // might throw anything
void f2() throw(int);            // can only throw ints
It is perfectly legal for f2 to call f1. Worse still, if f1 throws an exception other than int, unexpected() is called, which has default behaviour of calling terminate which kills your program.

There are also many problems when using exception specifications with templates; that I'm convinced you should never do.

Bruce Eckel's "Thinking in C++" says they're great, always use them. Jack Reeves ( says they're terrible, never use them.

Which one is it? I'm leaning towards never use them, and instead put in the documention for each function a list of possible exceptions that be thrown. Any other opinions?