警告 6530:无法识别的格式字符串样式 <名称>
![]() |
---|
此警告仅发生在使用源代码注释语言(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);