Partager via


C6513

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 C6513: invalid annotation: ElementSizeConst requires additional size properties

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

Annotation Properties