Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

C6508

warning C6508: invalid annotation: write access is not allowed on const values

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.

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);
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.