尝试使用cdecl这样的工具。解码后为:
declare p as pointer to array 2 of array 2 of pointer to function (int, int) returning pointer to int
p -- p
*p -- is a pointer
(*p)[2] -- to a 2-element array
(*p)[2][2] -- of 2-element arrays
*(*p)[2][2] -- of pointers
(*(*p)[2][2])( ); -- to functions
(*(*p)[2][2])(int,int); -- taking 2 int parameters
* (*(*p)[2][2])(int,int); -- and returning a pointer
int * (*(*p)[2][2])(int,int); -- to int
int *q(int x, int y) {...} // functions returning int *
int *r(int x, int y) {...}
int *s(int x, int y) {...}
int *t(int x, int y) {...}
...
int *(*fptr[2][2])(int,int) = {{p,q},{r,s}}; // 2x2 array of pointers to
// functions returning int *
...
int *(*(*p)[2][2])(int,int) = &fptr; // pointer to 2x2 array of pointers
// to functions returning int *
...
int *v0 = (*(*p)[0][0])(x,y); // calls q
int *v1 = (*(*p)[0][1])(x,y); // calls r
... // etc.
我相信它将p定义为指向一个2x2的指针数组,该数组包含指向函数(以(int a, int b)作为参数并返回int指针)的指针。
int* foo(int a, int b);
int* (*ptr_to_foo)(int, int) = &foo;
int* (*array_of_ptr_to_foo[2][2])(int, int);
array_of_ptr_to_foo[0][0] = &foo1;
array_of_ptr_to_foo[0][1] = &foo2;
/* and so on */
int* (*(*p)[2][2])(int, int);
p = &array_of_ptr_to_foo;