tl;dr: Is there a non-short circuit logical AND in C++ (similar to &&)?
I\'ve got 2 functions that I want to call, and use the return values to figure out th
and yes, I realize that I could use temporary variables to store the returns of the two functions and then do the "short-circuit" logic on the temporary variables, but I was wondering if there was an "elegant" language solution to keep the one-line return in Func3 while still getting the logging messages from both functions.
That would be the "elegant" solution :). Relying on the side effects of the evaluation order would be far from elegant, error prone, and hard to understand for the next developer who wanders into your project. Relying on the side effects of course contrasts with something like the following snippet, which is a completely logical and valid use case for relying on evaluation order alone:
if ( obj != NULL && obj->foo == blah ) { /* do stuff */ }