From -9215852091343789311
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,96a8c01f7043c2d9
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-09-27 08:31:12 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: pierrebai@hotmail.com (Pierre Baillargeon)
Newsgroups: comp.std.c++
Subject: Re: Proposal: exception stack unwinding resumption
Date: Fri, 27 Sep 2002 15:31:11 +0000 (UTC)
Organization: http://groups.google.com/
Lines: 63
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <6df0c6a8.0209261854.4b087f03@posting.google.com>
References: <6df0c6a8.0208260746.633710cb@posting.google.com> <6df0c6a8.0209170602.2cb54634@posting.google.com> <RW_h9.899$nU2.53545@newsfep1-gui.server.ntli.net> <6df0c6a8.0209201925.6faa9e57@posting.google.com> <c87c1cfb.0209220939.46d823af@posting.google.com> <6df0c6a8.0209230602.2aba3ca8@posting.google.com> <c87c1cfb.0209231924.6b639ab2@posting.google.com> <6df0c6a8.0209240716.6fb5ec00@posting.google.com> <c87c1cfb.0209252107.70dc6f8e@posting.google.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1033140671 5503 10.0.0.1 (27 Sep 2002 15:31:11 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 27 Sep 2002 15:31:11 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 17ux5B-0001Qc-00
	for mail2news@news.news.demon.net; Fri, 27 Sep 2002 15:31:10 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id BAA11989; Sat, 28 Sep 2002 01:30:36 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: 27 Sep 2002 02:54:45 GMT
Xref: archiver1.google.com comp.std.c++:14262

belvis@pacbell.net (Bob Bell) wrote in message news:<c87c1cfb.0209252107.70dc6f8e@posting.google.com>...
> pierrebai@hotmail.com (Pierre Baillargeon) wrote in message news:<6df0c6a8.0209240716.6fb5ec00@posting.google.com>...
> 
> Your proposal doesn't make it safe to throw from a destructor. It just
> prevents the program from calling std::terminate when a destructor
> throws, which is somewhat different. I guess that's the capsule
> summary of what I don't like about this proposal.

[...]

> I can't speak for Francis, but I would interpret his remark as
> "destructors should behave as if they were declared with a throw()
> exception specification." In other words, any exception escaping a
> destructor would lead to a call to std::unexpected. That's the
> behavior I would like.

[...]

> If an exception is thrown from some function that is _not_ a
> constructor, then only stack objects are destroyed. Therefore, if
> A::~A above throws, since the B part is not a stack object, B::~B will
> not be called.
> 
> I'd be interested in anybody else's opinion on this as well. I just
> ran a quick test in CodeWarrior 7, and it seems to agree with my
> interpretation.

[...]

> > I agree, it's the weak point of my proposal. Would it be more
> > acceptable if the proposed behavior would always be enabled? That
> > would not change the meaning of existing code, since it has really
> > been properly tested and reviewed right? ;-). Seriously folks, would
> > the proposal be more acceptable like that? I didn't say acceptable
> > (yet), just more...
> 
> Actually, it would be a step in the right direction. But getting back
> to the capsule summary line at the beginning of this post, it still
> would not make exceptions exiting from destructors safe.

Now I think I understand the fundamental misunderstanding we had: I
assumed that throwing from a destructor destroyed the data members and
base classes, while you didn't.

I rechecked the standard (after reading Francis Glassborow's reply):
it does mention partially destructed objects, so I was right and
CodeWarrior 7 is wrong.

So the capsule summary of my proposal is rather: if a destructor
throws an exception, and if terminate() would be called, it is as if a
try block catched the exception.

I still find it amazing that people have objections to this. I
understand that people could refuse to design destructors that can
throw, but I find it strange that they would actively resists having
the C++ language support those that would like to write such code.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



