In my compiler's printout of a function prototype looks like this:
int (__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned int)))(unsigned int)
I understand that __cdecl on the left of the asterisk specifies an attribute of a pointee. In this case it is a calling convention of a function to which the given pointer refers. It's akin 'const char *' denotes immutability of a data, pointed to, and not a pointer itself. I wander why is there __cdecl on the right of the same asterisk? Following the above logic it would mean an attribute of a pointer, like 'const char * const' means a constant pointer. But '__cdecl' is applicable only to the functions.
There are three functions in this declaration:
_set_new_handler
, the function that is being declared;The first __cdecl
applies to the function pointer that is being returned, the second one to the function that is being declared.