我想知道,例如,我是否有这个功能:
bool f(...) {
//something here
return true or f(...);
}
我知道它确实返回了 true
但它是在不评估语句的其他部分的情况下返回它还是再次评估函数?
最佳答案
这不会评估该函数,因为我们已经知道其中一个操作数为 or'd 为真。同样的事情发生在:
bool f(...) {
return false and f(...)
}
关于c++ - 在 bool 函数中返回 true 或其他内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13171644/