更新时间:2022-06-08 05:33:11
使用 指定的初始化器 .
It is initialization using Designated Initializers.
基于范围的初始化是gnu gcc扩展.
The range based initialization is a gnu gcc extension.
要将一系列元素初始化为相同的值,请写入
[first ... last] = value
.这是一个GNU扩展.例如
To initialize a range of elements to the same value, write
[first ... last] = value
. This is a GNU extension. For example,
int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
它不是便携式的.使用-pedantic
进行编译时会告诉您.
It is not portable. Compiling with -pedantic
with tell you so.
在这里如何工作?
预处理器将它的实际内容替换为#include <asm/unistd.h>
(它定义了其他符号常量和类型,并声明了其他函数),这是基于范围的构造,然后将其进一步用于初始化指针数组.
How does it work here?
The preprocessor replaces #include <asm/unistd.h>
with its actual contents(it defines miscellaneous symbolic constants and types, and declares miscellaneous functions) in the range based construct, which are then further used for initializing the array of pointers.