www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/08/03:09:07

Date: Wed, 8 Apr 1998 10:08:34 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: John Kismul <john DOT kismul AT bergen DOT mail DOT telia DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: SIGSEGV
In-Reply-To: <352A4DC4.6EC1@bergen.mail.telia.com>
Message-ID: <Pine.SUN.3.91.980408100811.17352F-100000@is>
MIME-Version: 1.0

On Tue, 7 Apr 1998, John Kismul wrote:

> signal(SIGSEGV,hello);
> 
> void hello(void)
> {
> return;
> }
> ***
> 
> But that don't work.

It *does* work (try "raise(SIGSEGV)" and you will see it yourself).

However, when SIGSEGV is generated by a *real* exception, the DJGPP
signal-generating machinery disallows such code and aborts your
program when it sees that the signal handler tries to return.  The
reason is that if you were allowed to return, the same exception would
be generated again and again, ad nauseum, because you return to the
same instruction that triggered the exception, and whatever condition
that caused the exception still exists.

The only way to prevent your program from aborting is to have your
signal handler longjmp into another place in your program.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019