In my experience, this sort of thing is usually caused by an badly behaved preprocessor macro somewhere.
Try generating a preprocessed version (cl /EP) of the source file to see the source text that the compiler sees after the preprocessor. Usually, this makes the problem apparent if there was a poorly behaved macro involved.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Friday, January 11, 2013 9:03 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] warning C4020: ‘function through pointer’ : too many actual parameters
I declared a function pointer typedef like this:
typedef VOID
(*PXN_DEVICE_CALLBACK)(PVOID context, ULONG type, PVOID value);
And then defined it in a structure called xppdd and called it like this:
xppdd->device_callback(NULL, 1, NULL);
and got the following error for the function call:
warning C4020: ‘function through pointer’ : too many actual parameters
Which was (in the end) caused by me using the word ‘type’ as a
parameter name. I checked and I can’t see where it is documented that
‘type’ is a reserved word for C, and if it was, I would have expected
an error not a vague warning that didn’t give me any useful clues as
to where the problem was.
I have changed type to callback_type and the problem has gone away,
I’m just curious as to why it behaved that way as it was really
frustrating for a few minutes.
In addition, one of my function declarations that gets assigned to xppdd->device_callback is declared like this:
static VOID
XenVbd_DeviceCallback(PVOID context, ULONG type, PVOID value) { …
}
And that use of the word ‘type’ presents no problems at all.
Thanks
James
NTDEV is sponsored by OSR
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer