klopyrev @ Sat Mar 24, 2007 5:06 pm wrote:
why would your ever have code like:
typedef void (*terminate_handler) ();
That says that a terminate_handler is a pointer to function taking no arguments and returning nothing.
You could pass pointers to functions so that the function pointed to can get called later (as a callback function).
Quote:
I keep reading about how void * allow versatility and such. What does that mean?
A void* can be used to point to an object of any type. For fixed function signatures (like in callback functions), it may be useful for there to be a void* parameter which could be an object of any type. The code that registers the callback can provide additional information to the callback function through the void* (both the callback function and the code that registers it will "know" the type involved).