[max_is(limited-expression-list )]
/* if m = 10, there are 11 transmitted elements (a[0]...a[10])*/
HRESULT Proc1(
[in] short m,
[in, max_is(m)] short a[]);
/* if m = 10, the valid range for b is b[0...10][20] */
HRESULT Proc2(
[in] short m,
[in, max_is(m)] short b[][20];
The max_is attribute designates the maximum value for a valid array index. For an array of size n in C, where the first array element is element number zero, the maximum value for a valid array index is n-1.
The max_is attribute cannot be used as a field attribute at the same time as the size_is attribute.
While it is legal to use the max_is attribute with a constant expression, doing so is inefficient and unnecessary. For example, use a fixed size array:
/* transmits values of a[0]... a[MAX_SIZE-1] */
HRESULT Proc3([in] short Arr[MAX_SIZE]);
instead of:
/* legal but marshalling code is much slower */
HRESULT Proc3([in max_is(MAX_SIZE-1)] short Arr[] );
field_attributes, IDL, min_is, size_is