Date: Thu, 5 Mar 1998 12:15:49 +0200 (IST) From: Eli Zaretskii To: "D. Huizenga" cc: djgpp AT delorie DOT com Subject: Re: Error Trapping -- How?? In-Reply-To: <34FE22ED.6BCF0CCE@concentric.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.