chris@mimsy.UUCP (Chris Torek) (10/13/89)
>In article <19999@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >> void (*signal(int, void (*)(int)))(int); In article <740@geovision.UUCP> pt@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 `, ...', which (on VMS and Unix VAXen, among others) makes no actual difference in function-call mechanism. What it does do, however, is allow one to write void int_handler(int sig, int code, struct sigcontext *scp) { ... SIGINT handling code ... } as on 4BSD. No doubt VMS also passes at least a `code' argument, so that you can tell different kinds of floating-point exceptions apart. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris
pt@geovision.uucp (Paul Tomblin) (10/16/89)
In article <20134@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >>In article <19999@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >>> void (*signal(int, void (*)(int)))(int); > >In article <740@geovision.UUCP> pt@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.