Stack unwinding and destructors?
From: Steven T. Hatton (susudata_at_setidava.kushan.aa)
Date: Mon, 09 Aug 2004 14:07:46 -0400
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
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