Possible Duplicate:
Is there an Non-Short circuited logical “and” in C++?
I'm looking for a simple way to force the right side of a boolean expression (||
&&
) to evaluate. Normally the right side is not evaluated if the left side can already determine the outcome.
Usually I revert to this syntax:
c = expr();
r = r || c;
since the following doesn't guarantee expr()
will be evaluated:
r = r || expr();
Is there a shorter/simpler syntax to replace what I'm doing now? Or do I already have the most compact form?
Tagged as C and C++ since the solution might be shared. I actually code in C++