Rui*_*res 1 c function-pointers objective-c void-pointers
我在一个我正在修补的程序中看到过这个:
static const void *method()
{
// other code
return anotherMethod(param1,param2);
}
Run Code Online (Sandbox Code Playgroud)
据我所知,这将返回一个指向函数的指针.现在基于此,我试图弄清楚static const void应用于什么:
int f(void);
int *fip(); //Function returning int pointer
int (*pfi)(); //Pointer to function returning int
Run Code Online (Sandbox Code Playgroud)
那么添加的真正优点是什么static const(假设这适用于指定函数的返回值).此外,是否会调用函数的返回指针?或者它只是指向它的指针?因为从代码我有以下内容:
void start()
{
method();
}
Run Code Online (Sandbox Code Playgroud)
我假设它将被调用,否则它将被分配给指针.
hmj*_*mjd 10
不,该函数将返回a const void*并将函数static的可见性限制为文件范围.