Warning C6500
Invalid annotation: value for 'name' property is invalid
Note
This warning occurs only in code that is using a deprecated version of the source-code annotation language (SAL). We recommend that you port your code to use the latest version of SAL. For more information, see Using SAL Annotations to Reduce C/C++ Code Defects.
Remarks
This warning indicates that a property value used in the annotation isn't valid. For example, it can occur if an incorrect level of dereference is used in the Deref
property, or if you use a constant value that is larger than size_t
for properties like ElementSize
.
Code analysis name: INVALID_ATTRIBUTE_PROPERTY
Example
The following code generates this warning because an incorrect level of dereference is used in the Pre
condition:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f( [SA_Pre( Deref=2, Access=SA_Read )] char buffer[] );
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [Pre( Deref=2, Access=Read )] char buffer[] );
To correct this warning, specify the correct level of dereference, as shown in the following sample code:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f( [SA_Pre( Deref=1, Access=SA_Read )] char buffer[] );
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [Pre( Deref=1, Access=Read )] char buffer[] );
This warning is generated for both Pre and Post conditions.