Typedef有两组括号? [英] Typedef with two sets of brackets?

查看:159
本文介绍了Typedef有两组括号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个typedef在一些代码,这是:

I have come across a typedef in some code which is this:

typedef void (NE_API *NeWindowProcCallback)(void* hWnd, NEuint uMsgId, NEuint wParam, NEuint64 lParam);

然而,我不熟悉这种语法。

however, I am unfamiliar with this syntax. can anyone explain this?

此外,如果我跳转到NE_API的声明,我发现这个:

Also, if I jump to the declaration of NE_API, I find this:

#   define NE_API __stdcall

我认为这可能与答案,并对此的解释也将非常感谢。谢谢。

I thought this may be relevant to the answer, and an explanation of this also would be very appreciated. Thank you.

推荐答案

这是函数指针的typedef,函数返回 void ,具有 __ stdcall 调用约定,并接受四个参数。因此,您可以将任何具有此签名的函数的地址分配给 NeWindowProcCallback 类型的变量。然后,这个变量可以作为参数传递给需要回调函数的其他函数。有关如何使用函数指针的更多详细信息,请参见

That is the typedef of a function pointer for which the function which returns void, has __stdcall calling convention, and accepts four parameters. So you can assign the address of any function which has this signature to a variable of type NeWindowProcCallback. This variable can then be passed as a parameter to other functions which expect a callback function. See this for more details on how function pointers can be used.

这篇关于Typedef有两组括号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆