Edit

Share via


Warning C6506

Invalid annotation: 'name' property may only be used on values of pointer or array types

Remarks

This warning indicates that a property is used on a type other than pointer or array types. The Access, Tainted, and Valid properties can be used on all data types. Other properties, such as ValidBytesConst, ValidElementsConst, ElementSize, and NullTerminted support pointer, pointer to members, or array types. For a complete list of properties and the supported data types, see Using SAL Annotations to reduce code defects.

Code analysis name: BUFFER_SIZE_ON_NON_POINTER_OR_ARRAY

Example

The following code generates this warning:

#include<sal.h>
void f(_Out_ char c)
{
    c = 'd';
}

To correct this warning, use a pointer or an array type, as shown in the following sample code:

#include<sal.h>
void f(_Out_ char *c)
{
    *c = 'd';
}

See also

C6516