[转]C++运算优先级列表
From:http://en.cppreference.com/w/cpp/language/operator_precedence
| Precedence | Operator | Description | Associativity |
|---|---|---|---|
| 1 | :: |
Scope resolution | Left-to-right |
| 2 | ++ -- |
Suffix/postfix increment and decrement | |
() |
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) |
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++运算优先级列表的更多相关文章
- PHP数据运算优先级总结记忆
运算符优先级
- java数据类型和运算优先级
一.数据类型 1.基本数据类型: . 布尔类型:boolean(true,false) . 整型:byte(-128,127).short(-32768,32767).int(-2147483648, ...
- [c/c++] programming之路(9)、运算优先级
一.运算优先级 二.条件运算符(表达式1?表达式2:表达式3) 当式1正确时,取式2的值:否则,取式3的值 三.格式字符 #include<stdio.h> #include<std ...
- C 运算优先级口诀
运算优先级口诀: 括号成员第一; //括号运算符[]() 成员运算符. -> 全体单目第二; //所有的单目运算符比如!.~.++. --. +(正). -(负) ...
- Python之路迭代器协议、for循环机制、三元运算、列表解析式、生成器
Python之路迭代器协议.for循环机制.三元运算.列表解析式.生成器 一.迭代器协议 a迭代的含义 迭代器即迭代的工具,那什么是迭代呢? #迭代是一个重复的过程,每次重复即一次迭代,并且每次迭代的 ...
- c语言运算优先级与结合方向的问题
c语言运算的结合方向一直困扰我,不过我终于get到了哈哈 先附上c语言运算优先级和结合方向图片 以上有c语言一共的15个优先级,从上往下递增 c语言的运算符号有很多,当我们打代码或者看代码的时候符号多 ...
- python函数,lambda表达式,三目运算,列表解析,递归
一.自定义函数 定义函数时,函数体不执行:只有在调用函数时,函数体才执行.函数的结构: 1. def 2. 函数名 3. 函数体 def func_name(): 函数体 4. 返回值 如果没有声明返 ...
- JavaScript 中运算优先级问题
优先级引发的问题 这篇文章对 JavaScript 中的运算符进行小结,很多人对运算符优先级这一知识点都是一带而过.这就导致在写一些比较奇葩的 js 代码,你并不知道它的输出是啥,下面举一个例子,这也 ...
- python各种运算优先级一览表
##python各种运算的优先级 运算符 描述 lambda Lambda表达式 or 布尔"或" and 布尔"与" not x 布尔"非" ...
随机推荐
- hiho_1050_树中的最长路
题目大意 给出一棵树,其中每两个节点都可以形成一个路径(要求路径中的边只能走一次),求出所有路径中的长度最大值. 分析 树形结构,很容易想到递归,但为了节省时间,要考虑保存中间状态.于是,考虑使用记忆 ...
- eclipse js卡顿
http://blog.csdn.net/zhangzikui/article/details/24805935
- 基于SpringBoot项目的https
在spring中配置项目运行的端口很简单. 在application.properties中 server.port: 这样配置后,spring boot内嵌的tomcat服务器就是跑在8080端口启 ...
- GATK原理及流程
用GATK跑了很久的流程,但还是不知道它的原理,现在项目要深入,没有流程可用,一切都要手动,所以必须开始着手了解GATK运行的原理,必须要知道需要输入什么,基本的算法,输出是什么. 参见: GATK使 ...
- 游戏引擎/GUI的设计与实现-常见GUI架构
以X Window为代表的客户/服务器架构. X Window通常是指X服务器及封装了通信协议的客户端库.服务器端主要负责输入事件的分发,窗口层次的管理,以及显示输出的处理,其它功能基本上都是在客户端 ...
- Python顺序集合之 tuple
慕课网<Python 入门>学习笔记 1.tuple特性 tuple是另一种有序的列表,中文翻译为“ 元组 ”.tuple 和 list 非常类似,但是,tuple一旦创建完毕,就不能修改 ...
- ERROR 1130: Host 'root@localhost' is not allowed to connect to MySQL server
连接mysql时遇到的错误. 原因:该用户没有权限连接访问mysql数据库 解决方法:网站上搜了好多,试了都没有用.最终在登陆的信息页面用root用户登陆时不输入root密码即可.
- ARM流水线关键技术分析与代码优化
引 言 流水线技术通 过多个功能部件并行工作来缩短程序执行时间,提高处理器核的效率和吞吐率,从而成为微处理器设计中最为重要的技术之一.ARM7处理器核使用了典型三级流 水线的冯·诺伊曼结构,AR ...
- MVC中使用HTML Helper类扩展HTML控件
文章摘自:http://www.cnblogs.com/zhangziqiu/archive/2009/03/18/1415005.html MVC在view页面,经常需要用到很多封装好的HTML控件 ...
- ios基础篇(七)——UISwich、UISlider、UIProgressView的用法总结
一.UISlider UIslider滑块控件在IOS开发中会常用到,可用于调节音量,字体大小等UI方面的交互:UISlider实例提供一个控件,让用户通过左右拖动一个滑块(可称其为“缩略图”)来选择 ...