次の方法で共有


C6500

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

This warning indicates that a property value used in the annotation is not 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.

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.

See Also

Deref