Dela via


C6512

warning C6512: invalid annotation: Null property must be Maybe if the Valid property is No

This warning indicates that Null is considered a valid value; therefore, Null cannot be used with the Valid property value of No.

Example

The following code generates this warning:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(Null=SA_Yes, Valid=SA_No)] char *pc);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(Null=Yes, Valid=No)] char *pc);

To correct this warning, use the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(Null=SA_Yes, Valid=SA_Maybe)] char *pc);
-or-
void f([SA_Pre(Null=SA_Yes, Valid=SA_Yes)] char *pc);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(Null=Yes, Valid=Maybe)] char *pc);
- or-
void f([Pre(Null=Yes, Valid=Yes)] char *pc);