type of signal functions (was Abandon NULL for (0))

Paul Tomblin pt at geovision.uucp
Mon Oct 16 23:37:04 AEST 1989


In article <20134 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>>In article <19999 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>>> void (*signal(int, void (*)(int)))(int);
>
>In article <740 at geovision.UUCP> pt at geovision.uucp (Paul Tomblin) writes:
>>For some strange reason, our VMS C compiler has the following in signal.h:
>>
>>int (*signal (int sig, void (*func)(int, ...)) ) (int, ...);
>>
>>which seems slightly contradictory. ... Someone care to comment on why
>>Dec did it this way, and if they are planning to fix it later?
>
>Well, aside from the `int' at the front (which is of course entirely
>incompatible with the `void' in the middle), the only difference is the
That was the thrust of my orignal posting.  How am I supposed to declare my
variable if I want to catch what the old signal handler was, install my new
signal handler, and later restore the old signal handler.  (We're trying to
come up with the correct definition for some typedefs to hide the
differences between VMS, Ultrix 3.1, Sun O/S 4.0, AIX, etc)
I.e.:
#include <local_types.h>
#include <signal.h>
TYPE1 sighandler(int signum)
{
    ....
}

int example(int fubar)
{
    TYPE2 (*old_handler)(int);
    TYPE1 sighandler();

    old_handler = signal(SIGALRM,sighandler);

    ....

    signal(SIGALRM,old_handler);

    return  retval;
}

Please fill in the blanks:

        ANSI comformant     brain dead VMS
TYPE1   void?               void?

TYPE2   void?               ????

-- 
Paul Tomblin,  Feeping Creaturism Section, DeptRedncyDept | ADA was invented 
    UUCP:   nrcaer!cognos!geovision!pt ??                 | because  Vogon 
    Disclaimer: The opinions expressed here aren't        | Poetry wasn't
    necessarily even mine!                                | deadly enough.



More information about the Comp.lang.c mailing list