Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

C6387

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 [Pre( Null=No )] attribute generates this warning.

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

#include <codeanalysis/sourceannotations.h>
using namespace vc_attributes;

[returnvalue:Post(Null=Yes)] char * g();

void f([Pre (Null=No)] char *pch);

void main()
{
    char *pCh=g();
    f(pCh); //C6387
}

To correct this warning, use the following code:

#include <codeanalysis/sourceannotations.h>
using namespace vc_attributes;

[returnvalue:Post(Null=No)] char * g();

void f([Pre (Null=No)] char *pch);

void main()
{
    char *pCh=g();
    f(pCh);
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.