C6518
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at C6518.
warning C6518: Invalid annotation: 'SAL_writableTo' property may not be specified as a precondition on buffers that are not writable: '_Param_(1)'
This warning indicates that a conflict exists between a SAL_writableTo property value and a writable property. This ordinarily indicates that a writable property does not have write access to the parameter being annotated.
The following code generates this warning because the _Out_ annotation compiles to include a SAL_writableTo property, which does not allow write access:
#include <sal.h> void f(_Out_ const char* pc) { //code that can't write to *pc ... }
To correct this warning, use the following code:
#include <sal.h> void f(_Out_ char* pc) { pc = "Hello World"; //code ... }
Show: