pointers to void functions

cam clarke clarke at h-sc1.UUCP
Sat Feb 15 06:43:55 AEST 1986


I wrote this piece of code to experiment with catching signals under 4.2 BSD
Unfortunately, cc and lint don't like the assignment "tch = catch;"
I can't figure out why, but when I change catch to be an int function and
change tch to point to an int function, my problem disappears. Anyone know
why?

#include <signal.h>
typedef void (*PFV)();

void catch()
{
    printf("Signal Number 2 caught\n");
}

main()
{
    PFV tch;
    tch = catch;
    (void) signal (2,catch);
    while(1) ;
}

			-Cam Clarke
			clarke at h-sc4.HARVARD.EDU
			clarke at h-sc4.UUCP



More information about the Comp.lang.c mailing list