[vox-tech] help with signals and C

Micah Cowan vox-tech@lists.lugod.org
14 Mar 2002 01:28:31 -0800


On Wed, 2002-03-13 at 10:52, Peter Jay Salzman wrote:

> looking through the man pages, i found that signal returns a type
> sighandler_t:
> 
>    sighandler_t signal(int signum, sighandler_t handler);

Actually, no it doesn't.  If you look more carefully, the manpage only
uses sighandler_t (an arbitrary type name) to explain the actual
prototype of signal():

  void (*signal(int signum, void (*sighandler)(int)))(int)

Trying to use a sighandler_t or, especially, __sighandler_t, is
ill-advised....  (and completely unlikely to change code behavior).

As to why the code is failing....  as far as ANSI C is concerned, an
implementation doesn't have to signal at all, regardless of what kind of
floating point exception occurs.  I don't know enough about the
specifics of Linux on Intel to tell you whether some circumstances might
actually cause the signal to be generated, but I believe someone here
mentioned trying integer zero-divide (SIGFPE doesn't have to be floating
point, really).

Micah