Udostępnij za pośrednictwem


ValidBytesLength

The ValidBytesLength property specifies either the number of bytes of an array or a buffer pointed to by a pointer that can be legally read. This property is allowed on Pre and Post attributes and can be applied to pointer or array data types.

The value of this property is specified in terms of a buffer parameter. The number of elements in the buffer parameter is used to determine the actual number of valid elements of an array or of a buffer pointed to by a pointer.

Example

The following code shows how to set the value of the ValidBytesLength property using a buffer parameter:

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

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

See Also

Concepts

Annotation Overview

Other Resources

Annotation Properties