警告 C6525: 大小规格无效: 属性值可能无效
![]() |
---|
此警告在使用源代码注释语言的代码仅发生 (SAL) 的一个弃用的版本。建议您端口您的代码使用 SAL 的最新版本。有关更多信息,请参见使用 SAL 批注以减少 C/C++ 代码缺陷。 |
此警告意味着用来指定大小的属性值无效。如果大小参数是用 Valid=No 批注的,则会出现此警告。
示例
在下面的代码中,因为 ValidElements 属性使用标记为无效的大小参数,所以会生成此警告:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(ValidElements="*count")] char * px, [SA_Pre(Valid=SA_No)]size_t *count);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(ValidElements="*count")] char * px, [Pre(Valid=No)]size_t *count);
若要更正此警告,请指定有效的大小参数,如下面的代码所示:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(ValidElements="*count")] char * px, [SA_Pre(Valid=SA_Yes)]size_t *count);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(ValidElements="*count")] char * px, [Pre(Valid=Yes)]size_t *count);