C6503

警告 C6503:无效注释: 引用和数组不可标记为 Null=Yes 或 Null=Maybe

说明说明

此警告仅发生在使用源代码注释语言(SAL) 的已弃用的版本代码中。建议使用 SAL 最新版本移植代码。有关详细信息,请参阅使用 SAL 批注以减少 C/C++ 代码缺陷

此警告意味着错误地对引用或数组类型使用了 Null 属性。引用用来存放对象的地址并且必须指向有效的对象。因为引用和数组类型不能为null,则必须通过删除Null属性或Null属性值设置为No。

示例

下面的代码生成此警告:

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

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

若要更正此警告,请将 Null 属性设置为 No,如下面的代码所示:

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

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

请参见

其他资源

批注属性