C6510

更新:2007 年 11 月

警告 C6510:无效的批注: NullTerminated 属性只能用于指针值或数组类型值

此警告意味着 NullTerminated 属性的使用不当。只能对指针或数组类型使用此属性。对其他任何数据类型使用 NullTerminated 属性都将生成警告 C6510。

示例

下面的代码生成此警告:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(NullTerminated=SA_No)] int x);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(NullTerminated=No)] int x);

为了更正此警告,下面的代码将参数 int x 修改为 int *x:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(NullTerminated=SA_No)] int *x);

//C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(NullTerminated=No)] int *x);

请参见

参考

C6516