在C语言中,为什么按位运算符(&和|)的优先级低于等于运算符(==)?这对我来说没有意义。
最佳答案
你需要问问 Brian Kernighan 或 Dennis Ritchie。
从这个论坛:http://bytes.com/topic/c/answers/167377-operator-precedence
The && and || operators were added later for their "short-circuiting" behavior. Dennis Ritchie admits in retrospect that the precedence of the bitwise operators should have been changed when the logical operators were added. But with several hundred kilobytes of C source code in existence at that point and an installed base of three computers, Dennis thought it would be too big of a change in the C language...
所以,这可能是一个原因?我猜是因为存在多层按位优先级(与关系比较不同),所以它存在于......永远......并且从未得到纠正。
关于c - 运算符优先级(按位 '&' 低于 '==' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4685072/