链接:
Exception Handling: A False Sense of Security
– C++ Report, Tom Cargill, Vol.6, No.9, November-December 1994
-
Argument expressions are fully evaluated before their function is called.
v[top–], top has been decremented before calling the copy construct return statement. Code:template T Stack::pop() { if( top < 0 ) throw ""pop on empty stack""; return v[top--]; // throw }
-
Don't worry about new exceptions, except catching bad_alloc exceptions and logging (the memory has to be enough). There is no good way, right? ? ?