Original Post
Say I have this function:
void func() {} If I do this: void (*f)() = func; It works, but if I do this: void (*&f)() = func; It gives me this error: 'initializing' : cannot convert from 'void (__cdecl *)(void)' to 'void (__cdecl *&)(void)' Does this mean that it's impossible to take a reference to a function pointer? If so, why not? Thanks in advance. EDIT: Looks like it's possible after all: void (*f)() = func;
void (*&f2)() = f; Don't know why I didn't think of this sooner. [smile] BTW, the same thing happens when trying to take a pointer to a pointer to a function. It works with the indirection above, but not without it, although in this case I think it's because placing & next to a function's name does nothing, i.e., the following are identical: void (*f)() = func;
void (*f2)() = &func So now my question is, is it possible to take a reference to a function pointer in one line of code (i.e., without the indirection)?