Udostępnij za pośrednictwem


WritableElements

The WritableElements property specifies either the number of elements of an array or a buffer pointed to by a pointer that can be legally written to. This property is allowed on Pre and Post attributes and can be used on pointer or array data types. The value of this property is an expression that involves another parameter that specifies the actual number of writable elements. The type of the size parameter can be any integral type within the size_t range. This parameter contains the actual number of writable elements.

Example

The following code shows how to use the WritableElements property:

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

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

See Also

Concepts

Annotation Overview

Other Resources

Annotation Properties