expression execution order
I'd like to call a number of functions, all which can only be called if the previous function succeeded. All functions return bool results, so just wondering what the best way to do this would be.
I'm currently using the following method:
Code:
if (func_a())
if (func_b())
if (func_c())
(etc...)
but wondering if this would be better:
Code:
if (func_a() && func_b() && func_c())
Problem is, would they all be called regardless of whether the previous one failed, or would execution stop when one of them returned FALSE? Or worse still, is the above unspecified, and depends on compiler?
Re: expression execution order
Use your first method
The second method may not work in all compilers (if any), the first method is easier to read, debug, and maintain.