C++ - Operator Precedence
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的更多相关文章
- PythonStudy——运算符优先级 Operator precedence
运算符优先级 以下所列优先级顺序按照从低到高优先级的顺序:同行为相同优先级. 1 Lambda #运算优先级最低 2 逻辑运算符: or 3 逻辑运算符: and 4 逻辑运算符:not 5 成员测试 ...
- [WPF系列]-DataBinding 绑定计算表达式
Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth, Converter={Stat ...
- Spring学习总结(四)——表达式语言 Spring Expression Language
SpEL简介与功能特性 Spring表达式语言(简称SpEL)是一个支持查询并在运行时操纵一个对象图的功能强大的表达式语言.SpEL语言的语法类似于统一EL,但提供了更多的功能,最主要的是显式方法调用 ...
- C语言宏定义时#(井号)和##(双井号)的用法
C语言中如何使用宏C(和C++)中的宏(Macro)属于编译器预处理的范畴,属于编译期概念(而非运行期概念).下面对常遇到的宏的使用问题做了简单总结. 关于#和## 在C语言的宏中,#的功能是将其后面 ...
- 【GoLang】50 个 Go 开发者常犯的错误
1. { 换行: Opening Brace Can't Be Placed on a Separate Line 2. 定义未使用的变量: Unused Variables 2. import ...
- 如何编写Iveely搜索引擎插件
如果一个搜索引擎仅仅是网页搜索,那么将会是非常枯燥的,也不能根据业务需求扩展,还好Iveely在设计之初,就考虑了扩展性,预留插件功能,在不关闭服务或者停用服务的情况下,可以随时启用新插件或者禁用. ...
- The P4 Language Specification v1.0.2 Header and Fields
前言 本文参考P4.org网站给出的<The P4 Language Specification v1.0.2>的第二部分首部及字段,仅供学习:). 欢迎交流! Header and Fi ...
- jython学习笔记2
1.%是求余,//是整除的商,**是乘方 abs(var) Absolute value pow(x, y) Can be used in place of ** operator pow(x,y,m ...
- [转]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 ...
随机推荐
- ubuntu rpm 包安装使用
ubuntu安装rpm的方法RED HAT系列用rpm包安装软件,Debian系列得用deb包.毕竟red hat历史悠久,有很多rpm软件包还未对应deb格式.(对应的地方现在是越来越多)在网上找了 ...
- oschina娱乐游戏
休闲游戏 123网络游戏 88单机游戏 201游戏模拟器/工具/引擎
- 完整的yuicompressor单个压缩和批量压缩以及gzip再次压缩,拦截器的配置等
下载地址:http://yuilibrary.com/download/yuicompressor/ 个人认为现在yuicompressor是最安全,最值得信赖的压缩工具,至少到现在没出现过问题 1. ...
- 百度编辑器ueditor简单易用
最近刚刚被分配任务给一个新闻发布,它采用了富文本编辑器.本人也被用于,只是这一次我选择了百度的富文本编辑器ueditor1_4_3-utf8-jsp版. 事实上看ueditor功能非常强大,只是百度的 ...
- 三种LVS负载均衡技术的优缺点----负载均衡调度算法
三种LVS负载均衡技术的优缺点归纳以下表: VS/NATVS/TUNVS/DR 服务器操作系统任意支持隧道多数(支持Non-arp) 服务器网络私有网络局域网/广域网局域网 服务器数目(100M网络) ...
- C#中调用Windows API时的数据类型对应关系
原文 C#中调用Windows API时的数据类型对应关系 BOOL=System.Int32 BOOLEAN=System.Int32 BYTE=System.UInt16 CHAR=System. ...
- 在JavaScript中也玩变量类型强行转换
<script language="javascript"> var str = '100'; var num = Number(100); a ...
- opencv分水岭算法对图像进行切割
先看效果 说明 使用分水岭算法对图像进行切割,设置一个标记图像能达到比較好的效果,还能防止过度切割. 1.这里首先对阈值化的二值图像进行腐蚀,去掉小的白色区域,得到图像的前景区域.并对前景区域用255 ...
- PHP - 接口&抽象类
什么时候使用抽象类什么时候使用接口? .如果要创建一个模型,这个模型将由一些紧密相关的对象采用,就可以使用抽象类.如果要创建将由一些不相关对象采用的功能,就使用接口. .如果必须从多个来源继承行为,就 ...
- TIA Portal V12不能添加新的CPU
4核AMD 740,10G内存,Win7 X64,打开TIA Portal V12,依旧慢如牛,鼠标指针转啊转,TIA窗口写着 无响应... 真没志气,STM32要是玩转了,坚决不用这老牛. 上图为正 ...