From 6283754607351123103
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,9723061da44e5214
X-Google-Attributes: gidf78e5,public
From: sbnaran@uiuc.edu (Siemel B. Naran)
Subject: Re: Exception while throwing an exception?
Date: 1999/09/08
Message-ID: <slrn7tbcgb.dp1.sbnaran@localhost.localdomain>#1/1
X-Deja-AN: 522607734
X-NNTP-Posting-Host: rochester-26.slip.uiuc.edu
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <37D3E50E.A13D8AFC@prodigy.net> <slrn7t8m3o.too.sbnaran@localhost.localdomain> <37D56411.F9600F29@ibm.net>
X-UID: 0000000001
X-Status: $$$T
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.7 (UNIX)
Reply-To: sbnaran@uiuc.edu
Newsgroups: comp.std.c++
Originator: clamage@taumet


On 7 Sep 1999 19:53:57 GMT, Biju Thomas <b_thomas@ibm.net> wrote:
>Siemel B. Naran wrote:
>> On 6 Sep 1999 20:53:57 GMT, Andy Larson <AndyLarson@prodigy.net> wrote:
 
>>>What is the required behavior when the constructor of an exception
>>>object throws an exception?  For example, if an exception is thrown as

>> The required behaviour is a call to std::terminate().
>
>I can't find such a specification in the standard. Can you tell where
>you found it?

I went by logic, because I don't know where in the standard to look for
the answer, and I should have said this.  Here is my reasoning: the
"throw E()" begins a throw process.  As E::E() throws an exception, we
have two exceptions in the picture.  So the result is a call to
std::terminate.

But after reading the other replies, as well as a private email from a
concerned C++ citizen, I think that my reasoning is wrong.  Consider
the following:
   { E e; throw e; } // version 1
It is obviously equivalent to
   { throw E(); } // version 2

Now in version 1, if E::E() throws an exception, say an exception of
type T, then it is this T exception-object that leaves the block.
As version 2 is equivalent to version 1, it is the exception of E::E()
or T that leaves the block.

The throw process only begins after the system has created the E
object, as another replier said.

-- 
--------------
siemel b naran
--------------


[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]




