Hi,
I have a question regarding the ampersand-operator.
I want to store the address of a class-member-function in an void *pointer (not in an class-member-pointer).
(the function is not virtual so no vtable stuff etc to think of)
I wonder why this:
Code:
void *blub2 = (void *)&CVictim::MemFunc;
does NOT compile, but this:
Code:
void *blub = (void *&)CVictim::MemFunc;
does.
Also i wonder why when I use a dirty union cast:
Code:
union {
void *pFunc;
void (CVictim::*mFunc)();
} weldPointers;
weldPointers.mFunc = &CVictim::MemFunc;
void *blub3 = weldPointers.pFunc;
it doesnt give the same result than blub.
Thanks in advance.
More
Edit:
I also wonder why it is possible to use the reference operator 2 times in this case:
Code:
void **blub4 = &(void *&)CVictim::MemFunc;