C28164

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at C28164.

warning C28164: The argument is being passed to a function that expects a pointer to an object (not a pointer to a pointer)

This warning is reported when a pointer to a pointer is used in a call to a function that is expecting a pointer to an object.

The function takes a PVOID in this position. Usually, this indicates that &pXXX was used when pXXX is required.

Some polymorphic functions (functions that can evaluate to, and be applied to, values of different types) are implemented in C by using a PVOID argument that takes any pointer type. However, this allows the programmer to code a pointer to a pointer without causing a compiler error, even when this type is not appropriate.

The following code example generates this warning:

PFAST_MUTEX pFm;  
...  
KeWaitForSingleObject(&pFm, UserRequest, UserMode, false, NULL);  

The following code example avoids the warning:

PFAST_MUTEX pFm;  
...  
KeWaitForSingleObject(pFm, UserRequest, UserMode, false, NULL);  

Show: