🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Throwing an exception from within a si

#3019
From: Steve Clamage
Date: Tue, 16 Jan 1996 18:30
27 lines
1865 bytes
In article 22h@galaxy.ucr.edu, thp@cs.ucr.edu (Tom Payne) writes:
>
>Implicit in a qestion of what the Standard says are the related
>questions of what it should say and why --- why shouldn't signal
>handlers be allowed to throw exceptions?  (The question seems both
>interesting and appropriate.)

Exceptions are synchronous, and unwind the stack from the point of the 
throw to the point of the handler. When an asynchronous signal arrives,
what is the state of the stack? Answer: unknown. In particular, the
stack might not even be in a consistent state -- arguments half pushed
during function entry or half popped during exit.

In C, a signal handler isn't allowed to do much of anything, precisely
because the program state can't be known and may be inconsistent. The
same is true in C++.

Allowing exceptions to be thrown from a signal handler would place a
noticeable penalty on all programs to provide locks on every function
entry and exit, even programs that didn't throw exceptions or use
signals.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <4dgj4m$9la@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <4dekiv$22h@galaxy.ucr.edu>

Show Full Headers
Complete Article Headers
From: clamage@Eng.Sun.COM (Steve Clamage)
Message-ID: <4dgj4m$9la@engnews1.Eng.Sun.COM>
X-Original-Date: 16 Jan 1996 16:18:30 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 16 Jan 96 18:30:56 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Throwing an exception from within a si
Organization: Sun Microsystems Inc.
References: <4dekiv$22h@galaxy.ucr.edu>
Reply-To: clamage@Eng.Sun.COM
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMPvu7OEDnX0m9pzZAQEi9AF/UstnNv+pm4V+r8uEmGF/BwOEQSZ5pH8s
 XU7QajGQt2NJ7u5PUO/3ykLP9E0nTd7o
 =a18R