C6530

警告 6530:无法识别的格式字符串样式 <name>

此警告意味着 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);