In Windows/MSVS/C++ I can get a function pointer by pointing to its name like this:
void foo()
{
auto fooPtr = &foo;
}
But can I do the same thing without knowing the name of the function?
void foo()
{
auto fnPtr = &thisFunction; //no
}
Use case: I want to define a macro I can put at the top of many functions which will declare a pointer to the function. Ex:
#define defFnPtr auto fnPtr = &thisFunction
void foo()
{
defFnPtr;
}
void bar()
{
defFnPtr;
}