Tainted
更新:2007 年 11 月
Tainted 屬性 (Property) 會指出某個值是否可安全地由其他函式使用。這個屬性 (Property) 可以用在 Pre 和 Post 屬性 (Attribute) 上,而且可以套用至任何資料型別。
Tainted 屬性 (Property) 必須使用下列其中一個值進行設定:
SA_Yes - 值已污染且無法信任。
SA_No - 值未污染且可以信任。
SA_Maybe - 值可能污染且無法信任。
範例
下列程式碼會顯示如何使用 Tainted 屬性:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(Tainted=SA_Yes)] int c);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(Tainted=Yes)] int c);