Style
更新:2007 年 11 月
Style 属性指定一个具有用于 SA_FormatString 属性的格式字符串的函数。在分析期间,将可变参数列表的类型与格式说明符进行比较,例如,格式字符串中的 %d 和 %s。
示例
下面的代码演示如何使用 Style 属性:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f( [SA_FormatString(Style="printf")] char *px, ...);
-or-
void f( [SA_FormatString(Style="scanf")] char *px, ...);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [FormatString(Style="printf")] char *px, ...);
-or-
void f( [FormatString(Style="scanf")] char *px, ...);