Hey guys,
Thanks for replying!
I see both of your points, and I think I understand now but I want to
clarify. Are you guys saying that whether short-circuit evaluation is
performed depends on precedence? If so, I get what you're saying.
To make sure I got this straight, the following :
Z || Z <<= Z
is evaluated as as
(Z || Z) <<= Z
and that's because the <<= operator has lower precedence. I imagine
that the short-circuit happens between the two Z's now, it evaluates
the first Z and finds it to be true (1) and doesn't evaluate the
second Z. It then does 1 <<= Z which is obviously an error. Got it.
Now in the case of :
Z || Z / 0
This compiles fine and evaluates to a 1. I would imagine that it is
evaluating this as :
Z || (Z / 0)
because the division operator has higher precedence. Now the short-
circuit happens completely different from the first example.... it's
now between the Z and the (Z / 0). Since the first Z evaluates to true
(1) it doesn't bother doing the rest.
If what I just said makes sense, then I understand now and I thank you
both! If not, then God help me!
Regards,
Anthony