Date: Wed, 8 Apr 1998 10:08:34 +0300 (IDT) From: Eli Zaretskii To: John Kismul cc: djgpp AT delorie DOT com Subject: Re: SIGSEGV In-Reply-To: <352A4DC4.6EC1@bergen.mail.telia.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.