Void function pointers
Suzanne Arroyo
sarroyo at govtdev-11w9.shearson.com
Fri Jan 25 04:05:12 AEST 1991
In article <2887 at casbah.acns.nwu.edu> hpa at casbah.acns.nwu.edu (Peter Anvin) writes:
> Turbo C++ always terminates with a hard "Type mismatch" error. Is this
> correct behavior.....?
Yes! Function foo was defined as:
void foo ( int p1, double p2, void ( *zoom)(int x, double y))
ie, taking three parameters: an int, a double, and a *pointer to a function returning void**
foo was called later with a pointer to a function returning *int* - causing the obvious
type mismatch
> is there a way to declare a pointer to a function returning *anything or void* but
> still specify its parameters?
A function must be declared with a single type - if you want it to be a catch-all type, then
void is your choice - the problem there is passing the right type function pointer
this works, but is messy:
foo ( 7, 3.131592653938789, (void(*)(int, double) )bar);
hope this helps
--
Suzanne Arroyo Wusses Are Fun People!!!!
Internet: sarroyo at govtdev-11w9.shearson.com
UUCP: ...!uunet!slcpi!sarroyo
More information about the Comp.lang.c
mailing list