Stack unwinding and destructors?

From: Steven T. Hatton (susudata_at_setidava.kushan.aa)
Date: 08/09/04

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
exception handling:

void g(int);

void f()
  string s;

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;"?

Hatton's Law: "There is only One inviolable Law"
KDevelop:  SuSE: