Call a void* as a function without declaring a function pointer

后端 未结 3 519
深忆病人
深忆病人 2021-02-05 15:32

I\'ve searched but couldn\'t find any results (my terminology may be off) so forgive me if this has been asked before.

I was wondering if there is an easy way to call a

3条回答
  •  既然无缘
    2021-02-05 16:32

    In C++: reinterpret_cast< void(*)() > (ptr) ()

    The use of reinterpret_cast saves you a set of confusing parentheses, and the < > clearly sets the type apart from the call itself.

提交回复
热议问题