On page 366 of TC++PL(SE) we are told " The destructor will be called
independently of whether the function is exited normally or exited because
an exception is thrown."
On page 382 the following appears:
"Consider the simple function f() that appears to have nothing to do with
exception handling:
void g(int);
void f()
{
string s;
//...
g(1);
g(2);
}
However, g() may throw an exception, so f() must contain code ensuring that
s is destroyed correctly in case of an exception."
These statements seem mutually inconsistent. Would it have been more
correct to use 'string* s = new string();' in place of "string s;"?
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org