
Casting function pointer to void pointer
Quote:
> Is storing a function pointer in a void *variable kosher
> with the ANSI C specification?
No, it's treif :)
Quote:
> I have had people tell me that this is forbidden by ANSI, but
> compilers seem to accept it.
void * is guaranteed to hold any pointer to _object_ type.
On the other hand all function poiner do have the same representation,
so you can arbitrarily choose any one of them as a generic function
pointer (but, unfortunately, you must explicitely cast to/from it).
--
Regards,
Alex Krol
Disclaimer: I'm not speaking for Scitex Corporation Ltd
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.