C6535

warning C6535: buffer cannot be of size <n>, bigger than max(size_t)

This warning indicates that the size of the buffer cannot be more than size_t. The type size_t is defined as an unsigned integer and its actual size is system dependent.

Example

The following sample code generates this warning because __int64 is used for ValidBytes which can only accept size_t type:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ValidBytes="c")] char *pc, __int64 c);

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

To correct this warning, use correct data type for the size, as shown in the following sample code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ValidBytes="c")] char *pc, size_t c);

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

ValidBytes property cannot be applied to a function pointer.