Freigeben über


C6508

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 C6508: invalid annotation: write access is not allowed on const values

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 the Access property specified on a const parameter implies that it can be written to. For constant values, Access=Read is the only valid setting.

Example

The following code generates this warning:

// C  
#include <CodeAnalysis\SourceAnnotations.h>  
void fD ([SA_Pre(Deref=1,Access=SA_Write)]const char *pc);   
  
// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
void f ([Pre(Deref=1,Access=Write)]const char *pc);  
  

To correct this warning, use the following code:

// C  
#include <CodeAnalysis\SourceAnnotations.h>  
void f ([SA_Pre(Deref=1,Access=SA_Read)]const char *pc);   
  
// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
void f ([Pre(Deref=1,Access=Read)]const char *pc);  

See Also

Deref
Access