《 C 陷阱 与 缺陷 》 运算 符 优先级 错误 ！
引用 楼主 incident_a 的 回复 : 书 上 说到 双目 运算 符 优先级 的 时候 ， 是 这样 的 ： Next come the true binary operators . The arithmetic operators have the highest precedence , then the shift operators , the relational operators , the logical operators , the assignment operators , and finally the conditional operator . 也就是说 赋值 运算 符 （ = ） 优先级 是 高于 条件 运算 符 （ ？ ：） 的 ， 往前 翻 了 下 书 ， 明显 不 对 啊 ， 实际上 应该 是 这样 ： ？ ： assignments ， 最后 应该 是 逗号 运算 符 啊 ， 难道 书 上 写错 了 ？ 看 了 下 ， 好像 是 有 点 问题 。 我 估计 他 的 意思 是 ， 对 下面 这 类 的 表达式 ： 1 < 2 ? 1 - 1 < < 2 : 3 ; 运算 符 的 优先 级 是 1 - 1 0 < < 2 然后 是 1 < 2 最后 是 返回 。 这 句 话 ： Next come the true binary operators . The arithmetic operators have the highest precedence , then the shift operators , the relational operators , the logical operators , the assignment operators , and finally the conditional operator . 改成 Next come the true binary operators . The arithmetic operators have the highest precedence , then the shift operators , the relational operators , the logical operators , and finally the conditional operator . 就 对 了 。 或者 向 你 说 的 一样 ， 改成 ： Next come the true binary operators . The arithmetic operators have the highest precedence , then the shift operators , the relational operators , the logical operators , the conditional operator , the assignment operators , and finally the comma operator .
