delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/05/05:17:06

Date: Thu, 5 Mar 1998 12:15:49 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "D. Huizenga" <skis AT concentric DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Error Trapping -- How??
In-Reply-To: <34FE22ED.6BCF0CCE@concentric.net>
Message-ID: <Pine.SUN.3.91.980305121530.11863T-100000@is>
MIME-Version: 1.0

On Wed, 4 Mar 1998, D. Huizenga wrote:

> What I mean is if something like an FPE occurs,
> is it possible to have DJGPP run a function which attempts to correct
> the problem?

You can use library function called `signal' to install your own
handler for the signal SIGFPE.  If you do that, your handler will be
called when an FPE occurs.  Read the library reference for `signal' to
see the rest of the details.

Keep in mind that one thing an FPE handler can NOT do is return to the
same place where the FPE happened.  If it does, the program will be
terminated, since otherwise the FPE will happen again, and again, ad
nauseum.

If you want to control which problems trigger an FPE, read the
documentation of the library function `_control87'.

For handling problems in math functions, there is a gentler
alternative: to write your own version of `matherr' function.

> This is probably a really stupid question, but thanks for
> your help.

Smart error recovery is NOT a stupid question, IMHO.

- Raw text -


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