From -5263461996019747774
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,96a8c01f7043c2d9
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-09-09 12:03:44 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: glancaster@ntlworld.com ("Garry Lancaster")
Newsgroups: comp.std.c++
Subject: Re: Proposal: exception stack unwinding resumption
Date: Mon, 9 Sep 2002 19:03:44 +0000 (UTC)
Organization: ntl Cablemodem News Service
Lines: 57
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <ar_e9.1193$Yc7.36404@newsfep2-gui>
References: <6df0c6a8.0208260746.633710cb@posting.google.com> <zllb9.458$S51.25977@newsfep1-gui.server.ntli.net> <6df0c6a8.0209030656.249192ce@posting.google.com> <tHkd9.24180$5g6.553497@newsfep2-win.server.ntli.net> <6df0c6a8.0209051026.5df687db@posting.google.com>
X-Trace: mail2news.demon.co.uk 1031598224 1818 10.0.0.1 (9 Sep 2002 19:03:44 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 9 Sep 2002 19:03:44 +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 17oTp0-0000TA-00
	for mail2news@news.news.demon.net; Mon, 09 Sep 2002 19:03:42 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id FAA22632; Tue, 10 Sep 2002 05:03:09 +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-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
X-NNTP-Posting-Date: Mon, 09 Sep 2002 11:09:10 BST
Xref: archiver1.google.com comp.std.c++:13720

Garry Lancaster:
> > Good general advice is to do as the standard library
> > does and not to throw from a destructor. Clean-up
> > which really can fail is done in a non-destructor
> > function.

Pierre Baillargeon:
> I'd agree if RAII had not made me so much more productive. I could
> write a long rant detailing my experience, but I'll simply say this:
> these posts made me reflect on my usage of RAII and I realized that
> for an entire year I completely forgot that there could be bugs in the
> base layer of my design because it has been so flawless, thanks to
> RAII. Unfortunately, it means my destructors can throw.

Aha. This is the root of all the confusion, I think. RAII
does not mean destructors must be able to throw.

If you are using your throwing destructors with the
standard libary or any other template library you
really need to address this misconception. See
for example this part of the C++ standard:

"[lib.res.on.functions] 17.4.3.6 Other functions

1 In certain cases (replacement functions, handler functions,
operations on types used to instantiate standard library
template components), the C + + Standard Library depends
on components supplied by a C + + program. If these
components do not meet their requirements, the Standard
places no requirements on the implementation.

2 In particular, the effects are undefined in the following
cases:
....
- if any replacement function or handler function or
destructor operation throws an exception, unless
specifically allowed in the applicable Required behavior
paragraph."

If you have a particular cleanup sequence you are
having trouble implementing without a no-throw
destructor, you could post it here, although the
solution will likely be along the lines already
discussed.

Kind regards

Garry Lancaster
Codemill Ltd
Visit our web site at http://www.codemill.net

---
[ 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                       ]



