You don't have to cast void * back and forth to anything.
void *p = /* ... */;
char *q = p;
Despite what the C++ weenies will say this is valid C! Please do not commit this cardinal sin:
char *p = (char*)malloc(n);
No no no! No need to cast that! Please just write:
char *p = malloc(n);
And if somebody tells you that won't compile without an explicit cast, please kindly remind them what language you are writing.
[Actually I agree with you that C++ templates are really nice, chiefly for the reason that they allow you to avoid function pointers. In C++ you can pass your "callback" to a template and it gets inlined right with the body of the function.]
[Actually I agree with you that C++ templates are really nice, chiefly for the reason that they allow you to avoid function pointers. In C++ you can pass your "callback" to a template and it gets inlined right with the body of the function.]