次の方法で共有


C6387

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C6387: <argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y

This warning is raised if an annotated function parameter is being passed an unexpected value. For example, passing a potentially null value to a parameter that is marked with _In_ annotation generates this warning.

Example

The following code generates this warning because a null parameter is passed to f(char *):

  
#include <sal.h>  
  
_Post_ _Null_ char * g();  
  
void f(_In_ char *pch);  
  
void main()  
{  
    char *pCh = g();  
    f(pCh); // Warning C6387  
}  

To correct this warning, use the following code:

  
#include <sal.h>  
  
_Post_ _Notnull_ char * g();  
  
void f(_In_ char *pch);  
  
void main()  
{  
    char *pCh = g();  
    f(pCh);  
}  

See Also

Annotation Overview
strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l