C6309
warning C6309: argument <number> is null: it does not adhere to function specification of <function>
This message indicates that the code is passing an unexpected NULL parameter as an argument to the specified API. Passing a null parameter to a function that expects a non-null parameter can cause unhandled exception.
Example
The following code generates warning 6309 and 6387:
#include <codeanalysis/sourceannotations.h>
using namespace vc_attributes;
void f([Pre(Null=No)] void*);
[returnvalue:Post(Null=Yes)] void* g();
void main()
{
f(g()); // 6309 and 6387
}
To correct both warnings, use the following code:
#include <codeanalysis/sourceannotations.h>
using namespace vc_attributes;
void f([Pre(Null=No)] void*);
[returnvalue:Post(Null=No)] void* g(); // pointer not null
void main()
{
f(g());
}