Afficher un message
Vieux 10/06/2008, 08h47   #9
Pete Becker
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Throwing exceptions in a unix signal handler. Good idea?

On 2008-06-09 17:45:04 +0200, thagor2008@googlemail.com said:

> On Jun 9, 4:26 pm, Pete Becker <p...@versatilecoding.com> wrote:
>> From the C99 standard: "If the signal occurs other than as the result

>
> That C, not C++.


It is both. C++ gets its specification for signal and raise from the C
standard.

>
>> So, unless the signal came from a call to abort or raise, the behavior
>> is undefined.

>
> It may be undefined from the point of view of the C standard , but not
> from the unix standard otherwise there'd be no point using signals -
> every time a handler was called you'd have to hold your breath and
> hope the program didn't crash!


Yes, that's correct.

>
> I'm only interested in the specific combination of C++ exceptions and
> signal handlers since once stores the stack and one forces an unwind.
> Are compilers smart enough to know to pop the signal handler stack
> first and return to where the signal occured before unwinding the
> stack for the exception is the question.
>
>


If you're interested in platform-specific behavior, you need to ask on
a newsgroup that discusses your platform. In standard C++, the behavior
is undefined.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

  Réponse avec citation
 
Page generated in 0,06746 seconds with 9 queries