Quick question: explain this typedef
typedef开发者_如何学C int py_var_t (void *);
it is used as:
py_var_t *somesymbol
It defines py_var_t to be the type of a function returning int and taking a void* pointer as argument.
This:
typedef int py_var_t (void *);
defines the type of the function as described by @milan1612. Then this:
py_var_t *somesymbol;
creates a pointer to such a function. You could also have created the pointer like this:
int (*somesymbol)(void *);
but use of typedefs is better practice, particularly when the function types get more complicated.
精彩评论