C6387
警告 C6387:<argument> 可能是 <value>:这不符合函数 <function name> 的规范:行: x, y
如果将意外的值传递给带批注的函数参数,会引发此警告。例如, 使用 _In_ 注解传递可能为 null 值的参数,则会生成此警告。
示例
在下面的代码中,因为向 f(char *) 传递一个 null 参数,所以会生成此警告:
#include <sal.h>
_Post_ _Null_ char * g();
void f(_In_ char *pch);
void main()
{
char *pCh = g();
f(pCh); // Warning C6387
}
若要更正此警告,请使用下面的代码:
#include <sal.h>
_Post_ _Notnull_ char * g();
void f(_In_ char *pch);
void main()
{
char *pCh = g();
f(pCh);
}
请参见
参考
strlen、wcslen、_mbslen、_mbslen_l、_mbstrlen、_mbstrlen_l