[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Operator precedence problem

On Mon, 6 Jun 2016 11:57 pm, Random832 wrote:

> Okay, can we settle on, as a principle, "the basic arithmetic operators
> (not to include **)  are the only ones whose precedence can be presumed
> to be obvious to all readers, 


> and other expressions may/should have 
> parentheses to make it more clear, even when not strictly necessary to
> the meaning of the expression"?

Sure, why not? So long as it is a "should" and not a "must".

> Sure, it's obvious to _me_ that << and >> have higher precedence than &
> and |, and that "and" has a higher precedence than "or", 

Do they?

Blimey, you're right. I always thought `and` and `or` had the same
precedence. And now that I know better, I have no doubt that I will forget
it again.