For readability purposes, I recommend declaring a type for the signature of any function you'll want have some pointer to:
typedef void my_sigt(void);
then, to declare a pointer to such a function, code:
and to get its size code sizeof(my_sigt*) (or sizeof(funptr) if you have such a variable funptr)
BTW, I am not sure that the C99 standard guarantees that every function pointer has the same size (or has the same size as some data pointer). But POSIX requires that (in particular, to be able to use dlsym for dynamic linking of such functions).
Asked in February 2016Viewed 2,333 timesVoted 5Answered 2 times