From 5420326600709748545
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/07
Message-ID: <slrn7t8m3o.too.sbnaran@localhost.localdomain>#1/1
X-Deja-AN: 522148158
X-NNTP-Posting-Host: bayou-60.slip.uiuc.edu
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <37D3E50E.A13D8AFC@prodigy.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 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
>in

The required behaviour is a call to std::terminate().
The default behaviour of std::terminate() is to call std::abort().
You can change the default behaviour at your option by using the
function std::set_terminate(void (*)()).

Coding guideline: try to make your exception objects not throw.
To avoid risking to throw an out-of-memory or std::bad_alloc,
avoid dynamic memory in the exception object.

Coding guideline: try to make your destructors of exception as
well as non-exception objects not throw.  If an object is being
destroyed because of an exception already in progress, then if
the destructor throws, we have two exceptions.  The result is a
call to std::terminate().


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




