3 ms·
Almost... You have a typed pointer to a function but that's not a void pointer and the "New C Standard" 6.3.2.3 states that you can't cast a function pointer t
by harrytuttle 13y ago
Almost...
You have a typed pointer to a function but that's not a void pointer and the "New C Standard" 6.3.2.3 states that you can't cast a function pointer to a void*.
- ygra 13y agoNot for function pointers; for passing data to callbacks that can be any type.
- harrytuttle 13y agoCan you provide an example? Not 100% sure in which context you are talking about.
- ygra 13y agoAs an example, SQLite: int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */ ); Here the void * is an argument that is passed in the callback as well so that you can update your own struct with the result, for example. Singe the library cannot know anything about your types, void * is the only option.
- harrytuttle 13y agoThanks for the example. Agree entirely then :)