大网数据广告活动
网络与域名解析

Array Attributes

· 52CE 我爱测

There is a close relationship between arrays and pointers in the C language.

There is a close relationship between arrays and pointers in the C language. When passed as a parameter to a function, an array name is treated as a pointer to the first element of the array, as shown in the following example:

/* fragment */
extern void f1(char * p1);

void main(void)
{
    char chArray[MAXSIZE];

    fLocal1(chArray);
}

In a local call, you can use the pointer parameter to march through memory and examine the contents of other addresses:

/* dump memory (fragment) */
void fLocal1(char * pch1)
{
    int i;

    for (i = 0; i < MAXSIZE; i++)
       printf("%c ", *pch1++);
}

When a client passes a pointer to a remote procedure, the client stub transmits both the pointer and the data it points to. Unless the pointer is restricted to its corresponding data, all the client's memory must be transmitted with every remote call. By enforcing strong typing in the interface definition, MIDL limits client-stub processing to the data that corresponds to the specified pointer.

The size of the array and the range of array elements transmitted to the remote computer can be constant or variable. When these values are variable, and thus determined at run time, you must use attributes in the IDL file to specify how many array elements to transmit. The following MIDL attributes support array bounds.

Attribute Description Default
[ first_is] Index of the first array element transmitted. 0
[ last_is] Index of the last array element transmitted. -
[ length_is] Total number of array elements transmitted. -
[ max_is] Highest valid array index value. -
[ min_is] Lowest valid array index value. 0
[ size_is] Total number of array elements allocated for the array. -

Note:
The min_is attribute is not implemented in RPC. The minimum array index is always treated as zero.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。