News for hackers. Stuff that matters.
Re:Our suite of Ethereum security tools by Buge on Saturday March 24, 2018 @05:42AM (#16665731)
>ORs evaluating left to right

There is only a single bitwise OR here, and no logical ORs. Whether they are evaluated left to right or right to left makes no difference in the execution of this expression.

Swap it left and right:

    (1 > 0 | 1)
And you'll see that C still gives you 1, and Python still gives you False.

>we have something that is not False ORed with True

No. We have (in the original Python equation) 1 ORed with 0. That results in 1. Then that resultant 1 is compared ('<') with 1. That comparison results in False .

The difference between Python and C is that in Python '|' has higher precedence than '<', but in C '<' has higher precedence than '|'. Dennis Ritchie admits that this is a mistake in the C language[1]. Python (and Solidity) have corrected that mistake.

The reason that '|' should have higher precedence than '<' is the same reason that '+' should have higher precedence than '<'. Namely, people want to do arithmetic calculations ('|' and '+') then compare the result of those calculations ('<' and '=='). There is essentially no situation where it is useful to have '<' have higher precedence than '|'.

[1] https://stackoverflow.com/questions/4685072/operator-precede...

Re:Our suite of Ethereum security tools by b6 on Saturday March 24, 2018 @06:34AM (#16665891)
Thanks for the explanation. I'm not familiar with Solidity and was assuming the intent was logical or.