c++ - 分析这句CPP代码:typedef action_t* (*rule_t)(const sandbox_t*, const event_t*, action_t*);
ringa_lee
ringa_lee 2017-04-17 11:20:24
0
2
600

在分析一个源码源码的时候看到了这么一句话:

typedef action_t* (*rule_t)(const sandbox_t*, const event_t*, action_t*);

。。。然后我就晕了。。。

呃。。。仔细看了看。。然后就明白了……
就是说一个叫做action_t类型的东西是个函数指针。。。(rule_t)是返回值类型,(const sandbox_t*, const event_t*, action_t*)是参数表

ringa_lee
ringa_lee

ringa_lee

reply all(2)
黄舟

rule_t is the name of typedef, which represents

返回值是action_t*, 参数是(const sandbox_t*, const event_t*, action_t*)的函数指针类型
小葫芦

Obviously not what you said!

action_t* is the return type
rule_t is the name of the function pointer
The following is the parameter table

In fact, we shouldn’t say that. We should say that rule_t is a function pointer, and the signature of the function it points to is similar to the following:

action_t* func(const sandbox_t*, const event_t*, action_t*);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template