연산자의 우선순위 단계 오류의 고통스러운 대가

3201 단어 연산자
Precedence
Operator
Description
Associativity
::
Scope resolution
Left-to-right
++     --
Suffix/postfix increment and decrement ()
Function call []
Array subscripting .
Element selection by reference ->
Element selection through pointer
++     --
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 newnew[]
Dynamic memory allocation deletedelete[]
Dynamic memory deallocation
.*     ->*
Pointer to member
Left-to-right
*     /     %
Multiplication, division, and remainder
+    
Addition and subtraction
<<     >>
Bitwise left shift and right shift
<     <=
For relational operators < and ≤ respectively >     >=
For relational operators > and ≥ respectively
==     !=
For relational = and ≠ respectively
&
Bitwise AND
십일^
Bitwise XOR (exclusive or)
십이|
Bitwise OR (inclusive or)
십삼&&
Logical AND
십사||
Logical OR
십오?:
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
십육throw
Throw operator (for exceptions)
십칠,
Comma
Left-to-right
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<>의 우선 순위가 +보다 높아 잘못된 결과를 초래했다고 생각합니다!
short c = (short)( (high << 8) + low);

short d = (short)( high << 8 + low);

short f = (short)( high << (8 + low));

// d f ,


좋은 웹페이지 즐겨찾기