🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3942

Re: Exception handling specs incomplete ?

#3942
From: Steve Clamage
Date: Sat, 06 Apr 1996 19:36
40 lines
2639 bytes
Alexander Krotoff <krotoff@boy.nmd.msu.ru> writes:

>I have two notes, about the behavior not specifed in the Jan 96 WP.

>1) While stack unwinding the destructor (or function indirectly called from
>the destructor) may try to do throw.

>As seems to me WP says nothing about this case. Is it allowed ?
>Is the behavior specified for this case ?

The section in the exceptions chapter describing the operation of
function terminate() says that from the point of the throw until the
exception handler is entered, if any user-written function exits via an
exception, terminate is called immediately. That includes your question.


>2) While stack unwinding the destructor may attempt to create
>new objects, or arrays of class objects with non-trivial destructors
>via operator new. Shall this outside exception affect creation of
>new objects ? (Inner exception will cause destructor calls for all
>already created base classes sub-objects and completely created array
>elements.

During stack unwinding, destructors for auto objects are called as
their block is exited. Those destructors do whatever they do. The
fact of being invoked as part of stack unwinding has only one
consequence: if the destructor exits via an exception, terminate() is
called.  A destructor can call function uncaught_exception() to determine
whether exception handling is in progress. ("uncaught_exception() is
a recent addition to the draft standard, and I don't know of any
compilers that support it yet.)
--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <4k61hc$l3i@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <199604051329.RAA04194@boy.nmd.msu.ru>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: Exception handling specs incomplete ?
Date: 06 Apr 1996 11:36:01 PST
Organization: Sun Microsystems Inc., Mountain View, CA
Approved: austern@isolde.mti.sgi.com
Message-ID: <4k61hc$l3i@engnews1.Eng.Sun.COM>
References: <199604051329.RAA04194@boy.nmd.msu.ru>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 6 Apr 1996 15:10:36 GMT
X-Newsreader: NN version 6.5.0 #21 (NOV)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMWbHoky4NqrwXLNJAQHsUwH/Q0kUbhqc4wabo24eVqX1JnXa5qT7v37X
 y4uvWwWrXnMrJN0KUIIOCSkEhm0pQzi+6l2Vz4DrVdEuyArbZz4dVQ==
 =VHkI
Originator: austern@isolde.mti.sgi.com