警告 6530:无法识别的格式字符串样式 <name>
![]() |
---|
此警告在使用源代码注释语言的代码仅发生 (SAL) 的一个弃用的版本。建议您端口您的代码使用 SAL 的最新版本。有关更多信息,请参见使用 SAL 批注以减少 C/C++ 代码缺陷。 |
此警告意味着 FormatString 属性使用的是 scanf 或 printf 之外的值。若要更正此警告,请检查您的代码并对 Style 属性使用有效值。
示例
在下面的代码中,因为 Style 属性中有键入错误,所以会生成此警告:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_FormatString(Style="printfd")] char *px);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([FormatString(Style="printfd")] char *px);
若要更正此警告,请使用有效的 Style,如下面的代码所示:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_FormatString(Style="printf")] char *px);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([FormatString(Style="printf")] char *px);