?: 在 C++ 中是什么意思?

Gat*_*ito 3 c++

我找到了这段代码:

std::string(avdInfo_getSystemImagePath(m_avd)
                                ?: avdInfo_getSystemInitImagePath(m_avd))
Run Code Online (Sandbox Code Playgroud)

我只找到了有关条件运算符的信息:http : //www.cplusplus.com/articles/1AUq5Di1/

那是, ?和 : 是分开的。但是,当他们在一起时,这意味着什么?既avdInfo_getSystemImagePathavdInfo_getSystemInitImagePath回报char*

Car*_*rum 7

这是一个GCC 扩展

x ?: y
Run Code Online (Sandbox Code Playgroud)

是相同的

x ? x : y
Run Code Online (Sandbox Code Playgroud)

除了那只x会被评估一次。