三元 C 运算符如何解释空的第一个分支?为什么?

How does the ternary C operator interpret an empty 1st branch? Why?

使用 gcc -Wall (4.9.2)

这似乎可以编译并且 运行 没有警告
#include <stdio.h>
int main(int argc, char **argv){
    printf("%d\n", argc-1?:42);
    return 0;
}

如果我运行它

如果我假设 x?:y 在这种情况下等同于 x?x:y,我是对的吗?这是标准的、预期的行为,还是只是 GCC 的怪癖?

这是条件运算符 shorthand 版本的已知 gcc extension

 argc-1?:42

相同
(argc-1)?(argc-1):42

使用这个变体的原因是(我引用)

"When it becomes useful is when the first operand does, or may (if it is a macro argument), contain a side effect. Then repeating the operand in the middle would perform the side effect twice. Omitting the middle operand uses the value already computed without the undesirable effects of recomputing it."