Hi all! This is actually a non-critical question, but I get this warning most of the time I use function pointers and still couldn't figure out why on my own. Consider the following prototype:
typedef void * Pointer;
void tree_destroyLineage(Tree greatest_parent, void *dataDestructor(Pointer data));
And so far I can compile my thousand-line-long code and get zero warnings. So I'm assuming I wrote the declaration correctly. But then I call it in code, passing free as my destructor, since the data stored in the tree nodes are simple structs:
tree_destroyLineage(decision_tree, free);
And this makes me get a "warning: passing argument 2 of 'tree_destroyLineage' from incompatible pointer type" message. My first hypotesis was that the compiler couldn't figure out at compile time that "Pointer" and "void *" are the same thing, so I tried both creating another function with the exact same types of the function pointer that "repasses" the call to free() and changing the function pointer declaration to accept a void * instead of a Pointer. Both approaches gave me the very same warning at the very same place.
What am I doing wrong and how do I solve it?
Thanks in advance.