WritableElementsConst

WritableElementsConst 属性指定指针指向的数组或缓冲区中可以合法写入的元素数目。 Pre 和 Post 特性上允许此属性,此属性可以在指针或数组数据类型上使用。

此属性的值是常数 size_t;若要指定依赖函数其他参数的可写入元素,请使用 WritableElements 属性。

示例

下面两个代码示例演示如何使用 WritableElementsConst 属性:

// 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); 

请参见

概念

批注概述

其他资源

批注属性