So I had a discussion with a colleague at work regarding the order of evaluation execution. Consider this conditional:
if (a > b && ref++) { do something }
We both agree that as per C standard the order is from left to right. However, the disagreement is that despite the order of evaluation, some instructions whose data will eventually be evaluated may be speculatively executed and then remain in this state despite the lazy evaluation.
For instance, ref
is incremented before evaluating a > b
, and the evaluation still happens left to right, that is the actual jump greater than
instruction for both a > b
and rev > 0
are executed in-order left to right, and abandoned at the first instance when !true. Now this goes against the whole concept of lazy evaluation, but what if ref
is a stream of instructions, an inlined function maybe. It would make more sense to start executing some instructions speculatively. The concern is: are those instructions committed, even half way through.
Thoughts?