It takes the address of the function ::TerminateThread
. This is of type
BOOL WINAPI (*)(HANDLE, DWORD).
HANDLE is defined as
typedef PVOID HANDLE;
So, the compiler wrote code to convert the 'function pointer' type to PVOID which is perfectly valid in C++ ($4.10/2)
"An rvalue of type “pointer to cv T,”
where T is an object type, can be
converted to an rvalue of type
“pointer to cv void.” The result of
converting a “pointer to cv T” to a
“pointer to cv void” points to the
start of the storage location where
the object of type T resides, as if
the object is a most derived object
(1.8) of type T (that is, not a base
class subobject)."
EDIT 2:
@dreamlax is correct. It appears that C++03 standard does not allow converting a function pointer to a void * as the program below shows
void f(){}
int main(){
void (*p)(void) = f;
void *p1 = p;
}
I wonder why.