in reply to Re^2: Short circuits in Logical AND (&&)
in thread Short circuits in Logical AND (&&)
Uh uh ... is that construction short-circuit? Not sure that it is. And if not, “not equivalent.”Rubbish.
Short-circuiting and not short-circuiting are only non-equivalent if the second expression has side-effects. Since it's not mentioned the variables are tied, it's safe to assume there's not short-circuiting happening.
So, under the stated assumptions (using 0 and 1), they are equivalent.
Not that I would use a construct. I find using bit-twiddling operators to do boolean logic a misplaced cuteness that serves nothing. To me, it smells like the author is saying "look at me, I think I've surpassed the level of grasshopper".
|
|---|