Export (0) Print
Expand All

C6523

warning C6523: invalid size specification: parameter <name> not found

This warning indicates that a parameter used to set a property value is not in the function parameter list. You can use annotation properties that accept the name of a parameter as their value, but you must make sure that the parameter exists and is of the correct data type.

The following code generates this warning because parameter count is missing:

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

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

To correct this warning, use the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ElementSize="count", ValidElementsConst=4)] char *pc, size_t count);
 
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(ElementSize="count", ValidElementsConst=4)] char *pc, size_t count);

Community Additions

ADD
Show:
© 2014 Microsoft