I like doing it in certain cases. It definitely helps in a while loop when you are working with a stream, iterator, or stack and pulling items off while it isn't empty. Not really sure about the if, it's just kind of convenient sometimes. Guess it all comes down to preference. Too much use and it becomes very unreadable.
With that if statement, does it first assign the value of db.getNextResult() and then check the elt.shouldProcess variable to see if it is true or false, or does it firstly check to see if elt.shouldProcess is true or false and then load the next result from the database?
According to C99, 6.5.16 clause 4, the order of evaluations on operands is undefined and if an attempt is made to modify or access the operand is after the next sequence point then the behavior is undefined.
Chris, && and || are short-circuited operators that create sequence points. They are exceptions to that rule.
except where noted [e.g. special rules for && and ||], the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is Unspecified.
This is basic stuff Chris, let's not debate the obvious, this kind of code is all over the place in the Linux kernel.
Also, where is the place in the C99 standard that details the exception? Genuinely curious. When I reviewed the standard, all that is said about the if statement is in section 126.96.36.199, and that says nothing about short circuited logic, certainly nothing about "exceptions to the rule". This seems compiler specific, but I'm happy to be shown to be wrong - if you can point me to the part in the standard.