Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic


The WritableBytesLength property specifies the number of bytes of an array, or buffer pointed to by a pointer, that can be legally written. 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 specified in terms of another 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.

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

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

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(WritableBytesLength="c") ] char *pc, char c[]);
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.