C6513

warning C6513: invalid annotation: ElementSizeConst requires additional size properties

This warning indicates that ElementSizeConst requires other properties that are missing from the annotation. Specifying ElementSizeConst alone does not provide any benefit to the analysis process. In addition to specifying ElementSize, other properties such as ValidElementsConst or WritableElementsConst must also be specified.

Example

The following code generates this warning:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ElementSizeConst=4)] void* pc);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(ElementSizeConst=4)] void* pc);

To correct this warning, use the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ElementSizeConst=4, ValidElementsConst=2)] void* pc);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(ElementSizeConst=4, ValidElementsConst=2)] void* pc);

Incorrect use of ElementSize property also generates this warning.

See Also

Other Resources

Annotation Properties