typedefs and prototypes
Michael Zehr
tada at athena.mit.edu
Wed Sep 21 05:37:56 AEST 1988
I'm writing a graphics interface library which ends up passing a lot
of pointers to functions. I've run into a problem with
typedefs and prototypes:
/* typedef and prototype declaration of a widget */
typedef void (*Keyboard_widget)(int key, void *data);
Keyboard_widget kb_widget1;
/* definition of a widget */
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???
Keyboard_widget kb_widget1 /* where do the formal parameters go??? */
{...}
Anyone have any suggestions?
(The reason why i want to use the typedef is that i have to pass
objects of type Keyboard_widget into some functions, and store them in
structures. i can use a "normal" prototype for the function but is it
strictly conforming when i later on pass a pointer to that function to
a procedure that's expecting a Keyboard_widget???)
-michael j zehr
More information about the Comp.lang.c
mailing list