C6518
警告 C6518:無效的附註:「SAL_writableTo」屬性不可以指定為先前條件在不能寫入的緩衝區:「是 (1)」
這則警告表示衝突存在於 SAL_writableTo 屬性值和可寫入的屬性之間。通常會是可寫入之屬性沒有正在為參數加註的寫入權限。
範例
下列程式碼會產生這項警告,因為 _Out_ 附註編譯包含 SAL_writableTo 屬性,而不允許寫入:
#include <sal.h>
void f(_Out_ const char* pc)
{
//code that can't write to *pc ...
}
若要更正這則警告,請使用下列程式碼:
#include <sal.h>
void f(_Out_ char* pc)
{
pc = "Hello World";
//code ...
}