Edit

Share via


Warning C6518

Invalid annotation: 'SAL_writableTo' property may not be specified as a precondition on buffers that are not writable: 'Parameter'.

Remarks

This warning indicates that a conflict exists between a SAL_writableTo property value and a writable property. The warning ordinarily indicates that a writable property doesn't have write access to the parameter being annotated.

Code analysis name: WRITABLE_SIZE_ON_NON_WRITABLE_BUFFER

Example

The following code generates this warning because the _Out_ annotation compiles to include a SAL_writableTo property, which doesn't 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 ...
}