?:在C++中是什么意思?
我找到了这段代码:
std::string(avdInfo_getSystemImagePath(m_avd)
?: avdInfo_getSystemInitImagePath(m_avd))
我只找到了有关条件运算符的信息:http : //www.cplusplus.com/articles/1AUq5Di1/
那是, ?和 : 是分开的。但是,当他们在一起时,这意味着什么?既avdInfo_getSystemImagePath与avdInfo_getSystemInitImagePath回报char*
回答
这是一个GCC 扩展。
x ?: y
是相同的
x ? x : y
除了那只x会被评估一次。