Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
C6503
Collapse the table of content
Expand the table of content

C6503

warning C6503: Invalid annotation: references and arrays may not be marked Null=Yes or Null=Maybe

Note Note

This warning occurs only in code that is using a deprecated version of the source-code annotation language (SAL). We recommend that you port your code to use the latest version of SAL. For more information, see Using SAL Annotations to Reduce C/C++ Code Defects.

This warning indicates that Null property is incorrectly used on a reference or array type. A reference or array type holds the address of an object and must point to a valid object. Because reference and array types cannot be null, you must correct the error by either removing the Null property or by setting the Null property value to No.

The following code generates this warning:

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
class Point
{
public:
    //  members
};

void f([Pre(Null=Yes)] Point& pt);

To correct this warning, set the Null property to No as shown in the following code:

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;

class Point
{
public:
    //  members
}; 
void f([Pre(Null=No)] Point& pt);
Show:
© 2015 Microsoft