What are intuitive reasons for >= and ‘>’ to be higher precedence than |? Reference.
I could understand why || is lower as writing a>b||c is common. However I’d think a>b|c would be doing an OR before the compare. This doesn’t seem intuitive. What are examples of &^| being lower precedence then compare/equity operators being intuitive?
What are intuitive reasons for >= and ‘>’ to be higher precedence than |
Share
It’s a historical accident, in The Development of the C Language, Dennis Ritchie wrote:
So it’s because B used
|and&for the logical operators, and C kept the precedence for the thus-denoted bitwise operators.