Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!hp4nl!duteca!kooijman From: kooijman@duteca (Richard Kooijman) Newsgroups: comp.std.c Subject: Re: typedefing functions (Re: Is typedef char BUFFER[20] legal?) Message-ID: <1213@duteca.UUCP> Date: 5 Feb 91 17:28:44 GMT References: <1212@tredysvr.Tredydev.Unisys.COM> <1991Jan29.210100.8105@zoo.toronto.edu> <22642@netcom.UUCP> <1991Feb3.000128.15980@zoo.toronto.edu> <1991Feb4.053613.3758@watmath.waterloo.edu> <1991Feb4.234441.17203@zoo.toro Organization: Delft University of Technology, Netherlands Lines: 45 henry@zoo.toronto.edu (Henry Spencer) writes: >In article enag@ifi.uio.no (Erik Naggum) writes: >>you can say >> typedef int f (int a, char *b); >>and later say >> f foo, bar, zot; >>and >> f *functab[3] = { foo, bar, zot, }; >Correct so far. >>The functions would be declared >> f foo >> { ... } >Nope, wrong. The function definition itself must contain an explicit >function declarator; it cannot inherit its "functionness" from a typedef. >See Constraints in 3.7.1. But what is the reason? I think it severely limits the use of typedef'ing functions, which could be otherwise very useful: typedef void cntrlc_handler(void); main() { cntrlc_handler c_handler; signal(SIGINT, c_handler); } It is a shame to be forced to define c_handler again: void c_handler(void) { ... } Richard.