WritableElementsConst
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

WritableElementsConst

The WritableElementsConst property specifies 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 a constant of size_t; to specify writable elements that depend on another parameter to the function, use the WritableElements property.

The following two code samples show how to use the WritableElementsConst property:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(WritableElementsConst=9)] char* pc); 
void f([SA_Pre(Deref=1, Access=SA_Write, WritableElementsConst=9)] char** pc); 

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(WritableElementsConst=9)] char* pc); 
void f([Pre(Deref=1, Access=Write, WritableElementsConst=9)] char** pc); 
Show:
© 2016 Microsoft