链接:
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在调用拷贝构造返回语句之前已经递减。代码:template T Stack::pop() { if( top < 0 ) throw ""pop on empty stack""; return v[top--]; // throw }
-
new异常就不要管了,除了捕获bad_alloc异常,打条日志(内存得想办法足够),没好办法吧???