Edit

Share via


Warning C6525

Invalid size specification: property value may not be valid

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.

Remarks

This warning indicates that the property value used to specify the size isn't valid. The warning occurs if the size parameter is annotated using Valid=No.

Code analysis name: INVALID_SIZE_STRING_UNREACHABLE_LOCATION

Example

The following code generates this warning because the ValidElements property uses a size parameter that is marked not valid:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(ValidElements="*count")] char * px, [SA_Pre(Valid=SA_No)]size_t *count);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(ValidElements="*count")] char * px, [Pre(Valid=No)]size_t *count);

To correct this warning, specify a valid size parameter as shown in the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(ValidElements="*count")] char * px, [SA_Pre(Valid=SA_Yes)]size_t *count);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(ValidElements="*count")] char * px, [Pre(Valid=Yes)]size_t *count);

See also

Using SAL Annotations to reduce code defects