Skip to content

Commit 4ffc0ea

Browse files
authored
Merge pull request #392 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to master to sync with https://github.com/MicrosoftDocs/cpp-docs (branch master)
2 parents b9d7906 + 7e1d855 commit 4ffc0ea

2 files changed

Lines changed: 87 additions & 85 deletions

File tree

docs/cpp/cpp-built-in-operators-precedence-and-associativity.md

Lines changed: 86 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -16,90 +16,92 @@ ms.author: "mblome"
1616
manager: "ghogen"
1717
---
1818
# C++ Built-in Operators, Precedence and Associativity
19-
The C++ language includes all C operators and adds several new operators. Operators specify an evaluation to be performed on one or more operands.
20-
21-
Operator precedence specifies the order of operations in expressions that contain more than one operator. Operator associativity specifies whether, in an expression that contains multiple operators with the same precedence, an operand is grouped with the one on its left or the one on its right. The following table shows the precedence and associativity of C++ operators (from highest to lowest precedence). Operators with the same precedence number have equal precedence unless another relationship is explicitly forced by parentheses.
22-
23-
### C++ Operator Precedence and Associativity
24-
25-
|Operator Description|Operator|
26-
|--------------------------|--------------|
27-
|`Group 1 precedence, no associativity`|
28-
|[Scope resolution](../cpp/scope-resolution-operator.md)|`::`|
29-
|`Group 2 precedence, left to right associativity`|
30-
|[Member selection (object or pointer)](../cpp/member-access-operators-dot-and.md)|`. or ->`|
31-
|[Array subscript](../cpp/subscript-operator.md)|`[ ]`|
32-
|[Function call](../cpp/function-call-operator-parens.md)|`( )`|
33-
|[Postfix increment](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|`++`|
34-
|[Postfix decrement](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|`--`|
35-
|[Type name](../cpp/typeid-operator.md)|`typeid( )`|
36-
|[Constant type conversion](../cpp/const-cast-operator.md)|`const_cast`|
37-
|[Dynamic type conversion](../cpp/dynamic-cast-operator.md)|`dynamic_cast`|
38-
|[Reinterpreted type conversion](../cpp/reinterpret-cast-operator.md)|`reinterpret_cast`|
39-
|[Static type conversion](../cpp/static-cast-operator.md)|`static_cast`|
40-
|`Group 3 precedence, right to left associativity`|
41-
|[Size of object or type](../cpp/sizeof-operator.md)|`sizeof`|
42-
|[Prefix increment](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|`++`|
43-
|[Prefix decrement](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|`--`|
44-
|[One's complement](../cpp/one-s-complement-operator-tilde.md)|`~`|
45-
|[Logical not](../cpp/logical-negation-operator-exclpt.md)|`!`|
46-
|[Unary negation](../cpp/unary-plus-and-negation-operators-plus-and.md)|`-`|
47-
|[Unary plus](../cpp/unary-plus-and-negation-operators-plus-and.md)|`+`|
48-
|[Address-of](../cpp/lvalue-reference-declarator-amp.md)|`&`|
49-
|[Indirection](../cpp/indirection-operator-star.md)|`*`|
50-
|[Create object](../cpp/new-operator-cpp.md)|`new`|
51-
|[Destroy object](../cpp/delete-operator-cpp.md)|`delete`|
52-
|[Cast](../cpp/cast-operator-parens.md)|`Cast: ()`|
53-
|`Group 4 precedence, left to right associativity`|
54-
|[Pointer-to-member (objects or pointers)](../cpp/pointer-to-member-operators-dot-star-and-star.md)|`.* or ->*`|
55-
|`Group 5 precedence, left to right associativity`|
56-
|[Multiplication](../cpp/multiplicative-operators-and-the-modulus-operator.md)|`*`|
57-
|[Division](../cpp/multiplicative-operators-and-the-modulus-operator.md)|`/`|
58-
|[Modulus](../cpp/multiplicative-operators-and-the-modulus-operator.md)|`%`|
59-
|`Group 6 precedence, left to right associativity`|
60-
|[Addition](../cpp/additive-operators-plus-and.md)|`+`|
61-
|[Subtraction](../cpp/additive-operators-plus-and.md)|`-`|
62-
|`Group 7 precedence, left to right associativity`|
63-
|[Left shift](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|`<<`|
64-
|[Right shift](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|`>>`|
65-
|`Group 8 precedence, left to right associativity`|
66-
|[Less than](../cpp/relational-operators-equal-and-equal.md)|`<`|
67-
|[Greater than](../cpp/relational-operators-equal-and-equal.md)|`>`|
68-
|[Less than or equal to](../cpp/relational-operators-equal-and-equal.md)|`<=`|
69-
|[Greater than or equal to](../cpp/relational-operators-equal-and-equal.md)|`>=`|
70-
|`Group 9 precedence, left to right associativity`|
71-
|[Equality](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|`==`|
72-
|[Inequality](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|`!=`|
73-
|`Group 10 precedence left to right associativity`|
74-
|[Bitwise AND](../cpp/bitwise-and-operator-amp.md)|`&`|
75-
|`Group 11 precedence, left to right associativity`|
76-
|[Bitwise exclusive OR](../cpp/bitwise-exclusive-or-operator-hat.md)|`^`|
77-
|`Group 12 precedence, left to right associativity`|
78-
|[Bitwise inclusive OR](../cpp/bitwise-inclusive-or-operator-pipe.md)|`&#124;`|
79-
|`Group 13 precedence, left to right associativity`|
80-
|[Logical AND](../cpp/logical-and-operator-amp-amp.md)|`&&`|
81-
|`Group 14 precedence, left to right associativity`|
82-
|[Logical OR](../cpp/logical-or-operator-pipe-pipe.md)|`&#124;&#124;`|
83-
|`Group 15 precedence, right to left associativity`|
84-
|[Conditional](../cpp/conditional-operator-q.md)|`? :`|
85-
|`Group 16 precedence, right to left associativity`|
86-
|[Assignment](../cpp/assignment-operators.md)|`=`|
87-
|[Multiplication assignment](../cpp/assignment-operators.md)|`*=`|
88-
|[Division assignment](../cpp/assignment-operators.md)|`/=`|
89-
|[Modulus assignment](../cpp/assignment-operators.md)|`%=`|
90-
|[Addition assignment](../cpp/assignment-operators.md)|`+=`|
91-
|[Subtraction assignment](../cpp/assignment-operators.md)|`-=`|
92-
|[Left-shift assignment](../cpp/assignment-operators.md)|`<<=`|
93-
|[Right-shift assignment](../cpp/assignment-operators.md)|`>>=`|
94-
|[Bitwise AND assignment](../cpp/assignment-operators.md)|`&=`|
95-
|[Bitwise inclusive OR assignment](../cpp/assignment-operators.md)|`&#124;=`|
96-
|[Bitwise exclusive OR assignment](../cpp/assignment-operators.md)|`^=`|
97-
|`Group 17 precedence, right to left associativity`|
98-
|[throw expression](../cpp/try-throw-and-catch-statements-cpp.md)|`throw`|
99-
|`Group 18 precedence, left to right associativity`|
100-
|[Comma](../cpp/comma-operator.md)|`,`|
101-
102-
## See Also
19+
20+
The C++ language includes all C operators and adds several new operators. Operators specify an evaluation to be performed on one or more operands.
21+
22+
Operator *precedence* specifies the order of operations in expressions that contain more than one operator. Operator *associativity* specifies whether, in an expression that contains multiple operators with the same precedence, an operand is grouped with the one on its left or the one on its right. The following table shows the precedence and associativity of C++ operators (from highest to lowest precedence). Operators with the same precedence number have equal precedence unless another relationship is explicitly forced by parentheses.
23+
24+
### C++ Operator Precedence and Associativity
25+
26+
|Operator Description|Operator|
27+
|--------------------------|--------------|
28+
|**Group 1 precedence, no associativity**|
29+
|[Scope resolution](../cpp/scope-resolution-operator.md)|[::](../cpp/scope-resolution-operator.md)|
30+
|**Group 2 precedence, left to right associativity**|
31+
|[Member selection (object or pointer)](../cpp/member-access-operators-dot-and.md)|[. or ->](../cpp/member-access-operators-dot-and.md)|
32+
|[Array subscript](../cpp/subscript-operator.md)|[&#91;&#93;](../cpp/subscript-operator.md)|
33+
|[Function call](../cpp/function-call-operator-parens.md)|[()](../cpp/function-call-operator-parens.md)|
34+
|[Postfix increment](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|[++](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|
35+
|[Postfix decrement](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|[--](../cpp/postfix-increment-and-decrement-operators-increment-and-decrement.md)|
36+
|[Type name](../cpp/typeid-operator.md)|[typeid](../cpp/typeid-operator.md)|
37+
|[Constant type conversion](../cpp/const-cast-operator.md)|[const_cast](../cpp/const-cast-operator.md)|
38+
|[Dynamic type conversion](../cpp/dynamic-cast-operator.md)|[dynamic_cast](../cpp/dynamic-cast-operator.md)|
39+
|[Reinterpreted type conversion](../cpp/reinterpret-cast-operator.md)|[reinterpret_cast](../cpp/reinterpret-cast-operator.md)|
40+
|[Static type conversion](../cpp/static-cast-operator.md)|[static_cast](../cpp/static-cast-operator.md)|
41+
|**Group 3 precedence, right to left associativity**|
42+
|[Size of object or type](../cpp/sizeof-operator.md)|[sizeof](../cpp/sizeof-operator.md)|
43+
|[Prefix increment](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|[++](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|
44+
|[Prefix decrement](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|[--](../cpp/prefix-increment-and-decrement-operators-increment-and-decrement.md)|
45+
|[One's complement](../cpp/one-s-complement-operator-tilde.md)|[~](../cpp/one-s-complement-operator-tilde.md)|
46+
|[Logical not](../cpp/logical-negation-operator-exclpt.md)|[!](../cpp/logical-negation-operator-exclpt.md)|
47+
|[Unary negation](../cpp/unary-plus-and-negation-operators-plus-and.md)|[-](../cpp/unary-plus-and-negation-operators-plus-and.md)|
48+
|[Unary plus](../cpp/unary-plus-and-negation-operators-plus-and.md)|[+](../cpp/unary-plus-and-negation-operators-plus-and.md)|
49+
|[Address-of](../cpp/address-of-operator-amp.md)|[&amp;](../cpp/address-of-operator-amp.md)|
50+
|[Indirection](../cpp/indirection-operator-star.md)|[&#42;](../cpp/indirection-operator-star.md)|
51+
|[Create object](../cpp/new-operator-cpp.md)|[new](../cpp/new-operator-cpp.md)|
52+
|[Destroy object](../cpp/delete-operator-cpp.md)|[delete](../cpp/delete-operator-cpp.md)|
53+
|[Cast](../cpp/cast-operator-parens.md)|[()](../cpp/cast-operator-parens.md)|
54+
|**Group 4 precedence, left to right associativity**|
55+
|[Pointer-to-member (objects or pointers)](../cpp/pointer-to-member-operators-dot-star-and-star.md)|[.&#42; or ->&#42;](../cpp/pointer-to-member-operators-dot-star-and-star.md)|
56+
|**Group 5 precedence, left to right associativity**|
57+
|[Multiplication](../cpp/multiplicative-operators-and-the-modulus-operator.md)|[&#42;](../cpp/multiplicative-operators-and-the-modulus-operator.md)|
58+
|[Division](../cpp/multiplicative-operators-and-the-modulus-operator.md)|[/](../cpp/multiplicative-operators-and-the-modulus-operator.md)|
59+
|[Modulus](../cpp/multiplicative-operators-and-the-modulus-operator.md)|[%](../cpp/multiplicative-operators-and-the-modulus-operator.md)|
60+
|**Group 6 precedence, left to right associativity**|
61+
|[Addition](../cpp/additive-operators-plus-and.md)|[+](../cpp/additive-operators-plus-and.md)|
62+
|[Subtraction](../cpp/additive-operators-plus-and.md)|[-](../cpp/additive-operators-plus-and.md)|
63+
|**Group 7 precedence, left to right associativity**|
64+
|[Left shift](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|[<<](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|
65+
|[Right shift](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|[>>](../cpp/left-shift-and-right-shift-operators-input-and-output.md)|
66+
|**Group 8 precedence, left to right associativity**|
67+
|[Less than](../cpp/relational-operators-equal-and-equal.md)|[<](../cpp/relational-operators-equal-and-equal.md)|
68+
|[Greater than](../cpp/relational-operators-equal-and-equal.md)|[>](../cpp/relational-operators-equal-and-equal.md)|
69+
|[Less than or equal to](../cpp/relational-operators-equal-and-equal.md)|[<=](../cpp/relational-operators-equal-and-equal.md)|
70+
|[Greater than or equal to](../cpp/relational-operators-equal-and-equal.md)|[>=](../cpp/relational-operators-equal-and-equal.md)|
71+
|**Group 9 precedence, left to right associativity**|
72+
|[Equality](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|[==](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|
73+
|[Inequality](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|[!=](../cpp/equality-operators-equal-equal-and-exclpt-equal.md)|
74+
|**Group 10 precedence left to right associativity**|
75+
|[Bitwise AND](../cpp/bitwise-and-operator-amp.md)|[&amp;](../cpp/bitwise-and-operator-amp.md)|
76+
|**Group 11 precedence, left to right associativity**|
77+
|[Bitwise exclusive OR](../cpp/bitwise-exclusive-or-operator-hat.md)|[^](../cpp/bitwise-exclusive-or-operator-hat.md)|
78+
|**Group 12 precedence, left to right associativity**|
79+
|[Bitwise inclusive OR](../cpp/bitwise-inclusive-or-operator-pipe.md)|[&#124;](../cpp/bitwise-inclusive-or-operator-pipe.md)|
80+
|**Group 13 precedence, left to right associativity**|
81+
|[Logical AND](../cpp/logical-and-operator-amp-amp.md)|[&amp;&amp;](../cpp/logical-and-operator-amp-amp.md)|
82+
|**Group 14 precedence, left to right associativity**|
83+
|[Logical OR](../cpp/logical-or-operator-pipe-pipe.md)|[&#124;&#124;](../cpp/logical-or-operator-pipe-pipe.md)|
84+
|**Group 15 precedence, right to left associativity**|
85+
|[Conditional](../cpp/conditional-operator-q.md)|[? :](../cpp/conditional-operator-q.md)|
86+
|**Group 16 precedence, right to left associativity**|
87+
|[Assignment](../cpp/assignment-operators.md)|[=](../cpp/assignment-operators.md)|
88+
|[Multiplication assignment](../cpp/assignment-operators.md)|[&#42;=](../cpp/assignment-operators.md)|
89+
|[Division assignment](../cpp/assignment-operators.md)|[/=](../cpp/assignment-operators.md)|
90+
|[Modulus assignment](../cpp/assignment-operators.md)|[%=](../cpp/assignment-operators.md)|
91+
|[Addition assignment](../cpp/assignment-operators.md)|[+=](../cpp/assignment-operators.md)|
92+
|[Subtraction assignment](../cpp/assignment-operators.md)|[-=](../cpp/assignment-operators.md)|
93+
|[Left-shift assignment](../cpp/assignment-operators.md)|[<<=](../cpp/assignment-operators.md)|
94+
|[Right-shift assignment](../cpp/assignment-operators.md)|[>>=](../cpp/assignment-operators.md)|
95+
|[Bitwise AND assignment](../cpp/assignment-operators.md)|[&amp;=](../cpp/assignment-operators.md)|
96+
|[Bitwise inclusive OR assignment](../cpp/assignment-operators.md)|[&#124;=](../cpp/assignment-operators.md)|
97+
|[Bitwise exclusive OR assignment](../cpp/assignment-operators.md)|[^=](../cpp/assignment-operators.md)|
98+
|**Group 17 precedence, right to left associativity**|
99+
|[throw expression](../cpp/try-throw-and-catch-statements-cpp.md)|[throw](../cpp/try-throw-and-catch-statements-cpp.md)|
100+
|**Group 18 precedence, left to right associativity**|
101+
|[Comma](../cpp/comma-operator.md)|[,](../cpp/comma-operator.md)|
102+
103+
## See Also
104+
103105
[Operator Overloading](operator-overloading.md)
104106

105107

docs/ide/non-msbuild-projects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Use the `output` property to specify the executable that will launch when you pr
176176
|`${file}`| the full path of the file or folder selected to run this task against (for example, "C:\sources\hello\src\hello.cpp")|
177177
|`${relativeFile}`| the relative path to the file or folder (for example, "src\hello.cpp")|
178178
|`${fileBasename}`| the name of the file without path or extension (for example, "hello")|
179-
|`${fileDirname}`| the the full path to the file, excluding the filename (for example, "C:\sources\hello\src")|
179+
|`${fileDirname}`| the full path to the file, excluding the filename (for example, "C:\sources\hello\src")|
180180
|`${fileExtname}`| the extension of the selected file (for example, ".cpp")|
181181

182182
#### Custom macros

0 commit comments

Comments
 (0)