I have never programmed in C, so please can anyone tell me what does this construction do:
void funcName(void * self)
{ ... }
as far as I understood
the funcName receives the pointer to the unknown data and this function receives nothing
but why there is a void * self
This is a function that takes a void pointer – a pointer without a specific type. Void pointer type lets you pass a pointer to any data type to a function that is declared like that. The function will have to cast the pointer to an appropriate type before reading/writing the data from it, or pass the pointer on to other functions that take
void*.Any pointer can be cast to
void*, implicitly or explicitly. For example, you can callfuncNamelike this:You can then call the same function with a different pointer type:
Judging from the name of the pointer,
self, it is likely that the function is trying to emulate object-oriented style of programming with constructs available in C. Instead of passing the pointer to data implicitly the way member-functions do, this style passes a pointer to data explicitly. The pointer is often calledthisorself.