Mail Archives: djgpp/1996/05/30/13:10:33
On Wed, 29 May 1996, Thomas Demmer wrote:
> In order to check libm for bugs, I got somhow stuck in the
> jungle of signal(SIGFPE,my_handler) and matherr(). According
> to my (pretty old) C docs, matherr() is an ANSI function, that
> can be redeclared in my own program.
No, it's not ANSI. It isn't even POSIX, I think (or else DJ would have
written one).
> With TC2.0 this
> works quite OK, djgpp and AIX cc do not handle that.
There is `matherr' in libm.a, so I'd guess if you link with -lm you
should be able to use it. But this will probably only work if you set up
x87 to not generate exceptions, and provided that the code of libm.a
functions tests the x87 status word and calls `matherr' when it sees any
abnormal bits set. (I don't have time right now to look into libm
sources and see whether it is done this way.)
The default math functions in libc.a don't support `matherr'.
> So, how can I find out from the signal handler which
> function caused the the signal with which args?
AFAIK, this is not how `matherr' is designed to work, see above. It shold
be called from the function that caused the problem, not from the signal
handler.
- Raw text -