[vox-tech] help with signals and C

vox-tech@lists.lugod.org vox-tech@lists.lugod.org
Wed, 13 Mar 2002 13:38:37 -0500


On Mon, Mar 11, 2002 at 12:43:32PM -0800, Peter Jay Salzman wrote:
> can someone post some example code of how to trap a SIGFPE signal and
> abort execution during the course of a C program on linux?

Pete,

  If you can provide a snip of code that invokes a FPE, then I can 
send you code to trap it.

    TTFN,
      Mike

  I wrote some stuff Monday night but nothing I tried (asside from kill
itself) would generate a SIGFPE, I tried all the simple things like
  a = 1.4 / 0.0;
  b = 1e150 / 1e-150;
  c = 1e-150 / 1e150;
  d = 1e150 * 1e150;
  etc...

(note that the compiler will warn about all of the above, so
I actually stuck things into variables and went through a few 
steps to do the above... but no SIGFPE)