C++符号优先级

//C++ Operators
// Operators specify an evaluation to be performed on one of the following:
// One operand (unary operator)
// Two operands (binary operator)
// Three operands (ternary operator)
// The C++ language includes all C operators and adds several new operators.
// Table 1.1 lists the operators available in Microsoft C++.
// Operators follow a strict precedence which defines the evaluation order of
//expressions containing these operators. Operators associate with either the
//expression on their left or the expression on their right; this is called
//“associativity.” Operators in the same group have equal precedence and are
//evaluated left to right in an expression unless explicitly forced by a pair of
//parentheses, ( ).
// Table 1.1 shows the precedence and associativity of C++ operators
// (from highest to lowest precedence).
//
//Table 1.1 C++ Operator Precedence and Associativity
// The highest precedence level is at the top of the table.

OperatorName or MeaningAssociativity
::Scope resolutionNone
::GlobalNone
[ ]Array subscriptLeft to right
( )Function callLeft to right
( )ConversionNone
.Member selection (object)Left to right
->Member selection (pointer)Left to right
++Postfix incrementNone
Postfix decrementNone
newAllocate objectNone
deleteDeallocate objectNone
delete[ ]Deallocate objectNone
++Prefix incrementNone
Prefix decrementNone
*DereferenceNone
&Address-ofNone
+Unary plusNone
-Arithmetic negation (unary)None
!Logical NOTNone
~Bitwise complementNone
sizeofSize of objectNone
sizeof ( )Size of typeNone
typeid( )type nameNone
(type)Type cast (conversion)Right to left
const_castType cast (conversion)None
dynamic_castType cast (conversion)None
reinterpret_castType cast (conversion)None
static_castType cast (conversion)None
.*Apply pointer to class member (objects)Left to right
->*Dereference pointer to class memberLeft to right
*MultiplicationLeft to right
/DivisionLeft to right
%Remainder (modulus)Left to right
+AdditionLeft to right
-SubtractionLeft to right
<<Left shiftLeft to right
>>Right shiftLeft to right
<Less thanLeft to right
>Greater thanLeft to right
<=Less than or equal toLeft to right
>=Greater than or equal toLeft to right
==EqualityLeft to right
!=InequalityLeft to right
&Bitwise ANDLeft to right
^Bitwise exclusive ORLeft to right
|Bitwise ORLeft to right
&&Logical ANDLeft to right
||Logical ORLeft to right
e1?e2:e3ConditionalRight to left
=AssignmentRight to left
*=Multiplication assignmentRight to left
/=Division assignmentRight to left
%=Modulus assignmentRight to left
+=Addition assignmentRight to left
-=Subtraction assignmentRight to left
<<=Left-shift assignmentRight to left
>>=Right-shift assignmentRight to left
&=Bitwise AND assignmentRight to left
|=Bitwise inclusive OR assignmentRight to left
^=Bitwise exclusive OR assignmentRight to left
,CommaLeft to right
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值