|
|
|
|
|
by meindnoch
1212 days ago
|
|
You're wrong. if (cheapCheck() && expensiveCheck()) { ... }
is not equivalent to bool cheap = cheapCheck();
bool expensive = expensiveCheck();
if (cheap && expensive) { ... }
unless we're in a lazy pure functional language. |
|
And in any case the author misidentified the problem and solution. The problem is that C++ coerces bool to int. I'm 99% sure there's a warning for that that you can turn into an error.