Udostępnij za pośrednictwem


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.

Example

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);

See Also

Reference

C6516