C++ 运算符优先级:
:: scope resolution lr
() funtion call lr
[] array acess
-> member access
. member access
++ -- postfix
dynamic_cast static_cast reinterpret_cast const_pret type conversion
typeid get type information
! logical negation rl
~ bitwise logical negation
++ -- prefix
+ -
* & reference
sizeof
new new[] delete delete[]
(type)
->*
.*
* / %
+ -
<< >>
< <= > >=
== !=
&
^
|
&&
||
?:
= += -= *= %= /= &= |= ^= <<= >>=
,
除去第三优先级( ! ~ ++ --(prefix) + - dynamic_cast static_cast reinterpret_cast const_cast type_id) 以及赋值运算符和条件运算符外,全部为自左向右赋值的顺序。
chinaunix网友2011-03-27 18:34:11
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com