Export (0) Print
Expand All

C6510

warning C6510: invalid annotation: NullTerminated property may only be used on values of pointer or array type

This warning indicates an incorrect use of the NullTerminated property. You can only use this property on pointer or array types. Use of NullTerminated property on any other data type will generate warning C6510.

The following code generates this warning:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(NullTerminated=SA_No)] int x);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(NullTerminated=No)] int x);

To correct this warning, the following code modifies the parameter int x to int *x:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(NullTerminated=SA_No)] int *x);

//C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(NullTerminated=No)] int *x);

Reference

Community Additions

ADD
Show:
© 2014 Microsoft