I have seen this on a program that I am tinkering:
static const void *method()
{
// other code
return anotherMethod(param1,param2);
}
For what I understand, this will return a pointer to a function. Now based on this, I am trying to figure it what the static const void are applied to:
int f(void);
int *fip(); //Function returning int pointer
int (*pfi)(); //Pointer to function returning int
So what are the real advantages of adding the static const (assuming this is applied to the return valued of the appointed function). Also, will the return pointer to a function be called? Or it’s just a pointer to it? Because from the code I have the following:
void start()
{
method();
}
I am assuming it will be called, otherwise it would have been assigned to a pointer.
No, the function will return a
const void*and thestaticrestricts the visibility of the function to file scope.