WritableBytes
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

WritableBytes

The WritableBytes property specifies either the number of bytes 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 and array data types. The value of this property is an expression that involves another parameter, which contains the actual number of writable bytes.

The following code shows how to use WritableBytes property:

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

// use of dereference operator
void f ([SA_Pre(WritableBytes="*c")] char *pc, size_t *c); 

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

// use of dereference operator
void f ([Pre(WritableBytes="*c")] char *pc, size_t *c); 
Show:
© 2016 Microsoft