Cast to function pointer?

天涯浪子 提交于 2019-11-30 04:38:28

Yes it is correct. I find that not very readable, so I suggest declaring the signature of the function to be pointed:

 typedef void sigrout_t(void*);

I also have the coding convention that types ending with rout_t are such types for functions signatures. You might name it otherwise, since _t is a suffix reserved by Posix

latter on I am casting, perhaps to call it like

 ((sigrout_t*) SGENT_1_calc) (someptr);

Yes it is, the function should be looking like this

void func(void*);

But the statement is missing a target, since a cast to nothing is useless. So it should be like

func = (void (*)(void *))SGENT_1_calc;

Yes it is a cast as you have stated.

yes its a function pointer which you can assign to a function with proto void funcname(void*) Here the SGENT_1_calc can be directly assigned to funcname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!