The following table lists the precedence and associativity of C++ operators. Operators are listed top to bottom, in descending precedence.

Precedence Operator Description Associativity
1 :: Scope resolution Left-to-right
2 ++  -- Suffix/postfix increment and decrement
type()type{} Function-style type cast
() Function call
[] Array subscripting
. Element selection by reference
-> Element selection through pointer
3 ++  -- Prefix increment and decrement Right-to-left
+  - Unary plus and minus
!  ~ Logical NOT and bitwise NOT
(type) C-style type cast
* Indirection (dereference)
& Address-of
sizeof Size-of
new,new[] Dynamic memory allocation
delete,delete[] Dynamic memory deallocation
4 .*  ->* Pointer to member Left-to-right
5 *  /  % Multiplication, division, and remainder
6 +  - Addition and subtraction
7 <<  >> Bitwise left shift and right shift
8 <  <= For relational operators < and ≤ respectively
>  >= For relational operators > and ≥ respectively
9 ==  != For relational = and ≠ respectively
10 & Bitwise AND
11 ^ Bitwise XOR (exclusive or)
12 | Bitwise OR (inclusive or)
13 && Logical AND
14 || Logical OR
15 ?: Ternary conditional Right-to-left
= Direct assignment (provided by default for C++ classes)
+=  -= Assignment by sum and difference
*=  /=  %= Assignment by product, quotient, and remainder
<<=  >>= Assignment by bitwise left shift and right shift
&=  ^=  |= Assignment by bitwise AND, XOR, and OR
16 throw Throw operator (for exceptions)
17 , Comma Left-to-right

C++ - Operator Precedence的更多相关文章

  1. PythonStudy——运算符优先级 Operator precedence

    运算符优先级 以下所列优先级顺序按照从低到高优先级的顺序:同行为相同优先级. 1 Lambda #运算优先级最低 2 逻辑运算符: or 3 逻辑运算符: and 4 逻辑运算符:not 5 成员测试 ...

  2. [WPF系列]-DataBinding 绑定计算表达式

            Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth, Converter={Stat ...

  3. Spring学习总结(四)——表达式语言 Spring Expression Language

    SpEL简介与功能特性 Spring表达式语言(简称SpEL)是一个支持查询并在运行时操纵一个对象图的功能强大的表达式语言.SpEL语言的语法类似于统一EL,但提供了更多的功能,最主要的是显式方法调用 ...

  4. C语言宏定义时#(井号)和##(双井号)的用法

    C语言中如何使用宏C(和C++)中的宏(Macro)属于编译器预处理的范畴,属于编译期概念(而非运行期概念).下面对常遇到的宏的使用问题做了简单总结. 关于#和## 在C语言的宏中,#的功能是将其后面 ...

  5. 【GoLang】50 个 Go 开发者常犯的错误

    1. { 换行:   Opening Brace Can't Be Placed on a Separate Line 2. 定义未使用的变量:  Unused Variables 2. import ...

  6. 如何编写Iveely搜索引擎插件

    如果一个搜索引擎仅仅是网页搜索,那么将会是非常枯燥的,也不能根据业务需求扩展,还好Iveely在设计之初,就考虑了扩展性,预留插件功能,在不关闭服务或者停用服务的情况下,可以随时启用新插件或者禁用. ...

  7. The P4 Language Specification v1.0.2 Header and Fields

    前言 本文参考P4.org网站给出的<The P4 Language Specification v1.0.2>的第二部分首部及字段,仅供学习:). 欢迎交流! Header and Fi ...

  8. jython学习笔记2

    1.%是求余,//是整除的商,**是乘方 abs(var) Absolute value pow(x, y) Can be used in place of ** operator pow(x,y,m ...

  9. [转]50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs

    http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ 50 Shades of Go: Traps, Gotc ...

随机推荐

  1. Google Map Android api V2 中使用MapView遇到CameraUpdateFactory is not initialized!的解决办法

    先说一下 Map V2 API Key 的问题吧: 在打包APP时需要自己生成一个XXX.keystore 用这个密室库生成的SHA1去申请的key 作为AndroidManifest.xml 中的K ...

  2. 再写KMP算法

    #include<iostream> #include<string> using namespace std; void getNext(char const*T,int l ...

  3. 【Java Web】使用URLRewrite实现网站伪静态

    大部分搜索引擎都会优先考虑收录静态的HTML页面,而不是动态的*.jsp.*.php页面.但实际上绝大部分网站都是动态的,不可能全部是静态的HTML页面,因此互联网上大部分网站都会考虑伪静态——就是将 ...

  4. 使用VirtualBox SDK之初步编译

    VirtualBox成功编译出来后,在生成的out文件夹中会发现有SDK文件夹(当然也可以直接从官网下SDK),里面有例子,但是直接用Visual Studio编译的话会出一大堆错误,本文就是讲解如何 ...

  5. GExpert 1.38 实验版含经典代码格式工具 Berlin 编译版

    安装方法:修改install.reg,然后导入.源代码地址:http://blog.dummzeuch.de/experimental-gexperts-version/ http://bbs.2cc ...

  6. 通过ip拨号器来了解广播接收者

    1.继承广播接收者类 package com.example.ipdail; import android.content.BroadcastReceiver; import android.cont ...

  7. css图片上下垂直居中

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Windows 7 taskbar and startmenu pin

    原文 Windows 7 taskbar and startmenu pin 在Windows 7上,用户可以将自己喜欢的软件“钉”在开始菜单或任务栏,使用起来更加方便.但有时候我们也需要用程序来将这 ...

  9. Codeforces Round #199 (Div. 2) C. Cupboard and Balloons

    C. Cupboard and Balloons time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  10. POJ 1042 Gone Fishing (贪心)(刘汝佳黑书)

    Gone Fishing Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 30281   Accepted: 9124 Des ...