[英]c - *(void **) &(int[2]){0,PAGE_SIZE}; meaning?
Reading some kernel code. 阅读一些内核代码。
I cannot get my head on what this line is meaning 我无法理解这条线的含义
*(void **) &(int[2]){0,PAGE_SIZE};
and more, what does this means 更重要的是,这意味着什么
{0,PAGE_SIZE}
To me it doesn't look like a function with that comma. 对我而言,它看起来不像是逗号的函数。
What could be going on with this code ? 这段代码可能会发生什么? I don't understand the indirections here.
我不明白这里的间接性。
Is it a function or a cast ? 它是函数还是演员? What does the bracket part means ?
支架部分是什么意思? Seems so convoluted to me but definitely has a meaning.
似乎对我如此复杂,但绝对有意义。
(int[2]) { 0, PAGE_SIZE }
is an expression (called compound literal ) whose value is an array of two int
s. 是一个表达式(称为复合文字 ),其值是两个
int
的数组。 The address of this array is taken, casted to void **
, and dereferenced. 获取此数组的地址,将其转换为
void **
,并取消引用。
The net result is a reinterpretation of the array contents as a pointer to void. 最终结果是将数组内容重新解释为指向void的指针。
Note that you can take the address of a compound literal, as they are lvalues. 请注意,您可以获取复合文字的地址,因为它们是左值。 See eg.
见例如。 this question .
这个问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.