Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!uunet!shearson.com!newshost!sarroyo From: sarroyo@govtdev-11w9.shearson.com (Suzanne Arroyo) Newsgroups: comp.lang.c Subject: Re: Void function pointers Message-ID: Date: 24 Jan 91 17:05:12 GMT References: <2887@casbah.acns.nwu.edu> Sender: news@shearson.com (News) Distribution: usa Organization: Lehman Brothers Lines: 30 In-Reply-To: hpa@casbah.acns.nwu.edu's message of 24 Jan 91 05:28:58 GMT In article <2887@casbah.acns.nwu.edu> hpa@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@govtdev-11w9.shearson.com UUCP: ...!uunet!slcpi!sarroyo