C++ suggest change

Operator precedence

Operators are listed top to bottom, in descending precedence. Operators with the same number have equal precedence and the same associativity.

  1. ::
  2. The postfix operators: [] () T(...) . -> ++ -- dynamic_cast static_cast reinterpret_cast const_cast typeid
  3. The unary prefix operators: ++ -- \* & \+ \- \! ~ sizeof new delete delete[]; the C-style cast notation, (T)...; (C++11 and above) sizeof... alignof noexcept
  4. .* and ->*
  5. \*, /, and %, binary arithmetic operators
  6. \+ and \-, binary arithmetic operators
  7. << and >>
  8. \<, \>, <=, >=
  9. == and !=
  10. &, the bitwise AND operator
  11. ^
  12. |
  13. &&
  14. ||
  15. ?: (ternary conditional operator)
  16. =, *=, /=, %=, +=, -=, >>=, <<=, &=, ^=, |=
  17. throw
  18. , (the comma operator)

The assignment, compound assignment, and ternary conditional operators are right-associative. All other binary operators are left-associative.

The rules for the ternary conditional operator are a bit more complicated than simple precedence rules can express.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
4 Operator precedence
63 RAII
85 RTTI
  ↑ ↓ to navigate     ↵ to select     Esc to close