Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn From: gwyn@smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: typedefs and prototypes Message-ID: <8543@smoke.ARPA> Date: 20 Sep 88 20:41:00 GMT References: <7135@bloom-beacon.MIT.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <7135@bloom-beacon.MIT.EDU> tada@athena.mit.edu (Michael Zehr) writes: >typedef void (*Keyboard_widget)(int key, void *data); >void kb_widget1(int c, void *data) >I get a "conflicts with previous declaration" at that point. If I try >to define the widget by the typedef, what syntax do i use??? Use exactly the syntax of the typedef, minus "typedef", with the type name replaced by the identifier. I.e. void (*kb_widget1)(int key, void *data) { ... } >Keyboard_widget kb_widget1 /* where do the formal parameters go??? */ >{...} This one is a mystery to me too. The compilers I've tried this on are unhappy no matter how I try to use the typedef in defining the function. Fortunately the explicit definition is completely compatible, but it would be nice if the typedef method worked.