Skip to content

Commit a6a9584

Browse files
simnalamburtColin Robertson
authored andcommitted
There is no '&&=' operator (MicrosoftDocs#454)
* There is no '&&=' operator Closes #448 * Update assignment-operators.md Fix formatting issues and add links for copy assignment and move assignment.
1 parent 8480f16 commit a6a9584

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

docs/cpp/assignment-operators.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ ms.custom: ""
44
ms.date: "03/05/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|=", "&&="]
7+
f1_keywords: ["=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|="]
88
dev_langs: ["C++"]
9-
helpviewer_keywords: ["operators [C++], assignment", "assignment operators [C++], C++", "&= operator", "&&= operator", "^= operator", "+= operator", ">>= operator", "|= operator", "operator>>=", "*= operator", "%= operator", "^= operator", "operator >>=", "= operator", "-= operator", "/= operator", "<<= operator"]
9+
helpviewer_keywords: ["operators [C++], assignment", "assignment operators [C++], C++", "&= operator", "^= operator", "+= operator", ">>= operator", "|= operator", "operator>>=", "*= operator", "%= operator", "^= operator", "operator >>=", "= operator", "-= operator", "/= operator", "<<= operator"]
1010
ms.assetid: b028cf35-2ff1-4f14-9027-fd53ebec8aa0
1111
author: "mikeblome"
1212
ms.author: "mblome"
@@ -16,21 +16,20 @@ ms.workload: ["cplusplus"]
1616

1717
## Syntax
1818

19-
```
20-
expression assignment-operator expression 
21-
assignment-operator : one of
22-
   =   *=   /=   %=   +=   -=   <<=   >>=   &=   ^=   |= &&=
23-
```
19+
*expression* *assignment-operator* *expression*
20+
21+
*assignment-operator* : one of<br/>
22+
&nbsp;&nbsp;&nbsp;&nbsp;<strong>=   *=   /=   %=   +=   -=   \<\<=   >>=   &=   ^=   \|=</strong>
2423

2524
## Remarks
2625

27-
Assignment operators store a value in the object designated by the left operand. There are three kinds of assignment operations:
26+
Assignment operators store a value in the object designated by the left operand. There are two kinds of assignment operations:
2827

29-
1. simple assignment, in which the value of the second operand is stored in the object specified by the first operand. 1. compound assignment, in which an arithmetic, shift, or bitwise operation is performed prior to storing the result.
30-
1. move assignment (for class types) in which resources are transferred without copying.
28+
1. *simple assignment*, in which the value of the second operand is stored in the object specified by the first operand.
3129

30+
1. *compound assignment*, in which an arithmetic, shift, or bitwise operation is performed prior to storing the result.
3231

33-
All assignment operators in the following table except the = and &&= operators are compound assignment operators.
32+
All assignment operators in the following table except the = operator are compound assignment operators.
3433

3534
### Assignment Operators
3635

@@ -47,7 +46,6 @@ All assignment operators in the following table except the = and &&= operators a
4746
|**&=**|Obtain the bitwise AND of the first and second operands; store the result in the object specified by the first operand.|
4847
|**^=**|Obtain the bitwise exclusive OR of the first and second operands; store the result in the object specified by the first operand.|
4948
|**\|=**|Obtain the bitwise inclusive OR of the first and second operands; store the result in the object specified by the first operand.|
50-
|**&&=**| Move assignment operator (for class types only). If the second operand is an rvalue, move its resources to the first operand (without copying them). See [Move constructors and move assignment operators](move-constructors-and-move-assignment-operators-cpp.md) for more information.|
5149

5250
**Operator Keywords**
5351

@@ -87,11 +85,11 @@ int main() {
8785

8886
## Simple assignment
8987

90-
The simple assignment operator (=) causes the value of the second operand to be stored in the object specified by the first operand. If both objects are of arithmetic types, the right operand is converted to the type of the left, prior to storing the value.
88+
The simple assignment operator (**=**) causes the value of the second operand to be stored in the object specified by the first operand. If both objects are of arithmetic types, the right operand is converted to the type of the left, prior to storing the value.
9189

92-
Objects of const and volatile types can be assigned to l-values of types that are just volatile or that are neither const nor volatile.
90+
Objects of **const** and **volatile** types can be assigned to l-values of types that are just **volatile** or that are neither **const** nor **volatile**.
9391

94-
Assignment to objects of class type (struct, union, and class types) is performed by a function named operator=. The default behavior of this operator function is to perform a bitwise copy; however, this behavior can be modified using overloaded operators. (See [Overloaded Operators](../cpp/operator-overloading.md) for more information.)
92+
Assignment to objects of class type (struct, union, and class types) is performed by a function named `operator=`. The default behavior of this operator function is to perform a bitwise copy; however, this behavior can be modified using overloaded operators. See [Operator overloading](../cpp/operator-overloading.md) for more information. In addition, class types can have *copy assignment* and *move assignment* operators. For more information, see [Copy constructors and copy assignment operators](copy-constructors-and-copy-assignment-operators-cpp.md) and [Move constructors and move assignment operators](move-constructors-and-move-assignment-operators-cpp.md).
9593

9694
An object of any unambiguously derived class from a given base class can be assigned to an object of the base class. The reverse is not true because there is an implicit conversion from derived class to base class but not from base class to derived class. For example:
9795

@@ -148,21 +146,21 @@ B = A;
148146

149147
can have one of the following effects:
150148

151-
- Call the function operator= for `UserType2`, provided operator= is provided with a `UserType1` argument.
149+
- Call the function `operator=` for `UserType2`, provided `operator=` is provided with a `UserType1` argument.
152150

153151
- Call the explicit conversion function `UserType1::operator UserType2`, if such a function exists.
154152

155153
- Call a constructor `UserType2::UserType2`, provided such a constructor exists, that takes a `UserType1` argument and copies the result.
156154

157155
## Compound assignment
158156

159-
The compound assignment operators, shown in the table in [Assignment Operators](../cpp/assignment-operators.md), are specified in the form *e1* `op`= *e2*, where *e1* is a modifiable l-value not of const type and *e2* is one of the following:
157+
The compound assignment operators, shown in the table in [Assignment Operators](#assignment-operators), are specified in the form *e1* *op*= *e2*, where *e1* is a modifiable l-value not of **const** type and *e2* is one of the following:
160158

161159
- An arithmetic type
162160

163-
- A pointer, if `op` is + or -
161+
- A pointer, if *op* is **+** or **-**
164162

165-
The *e1* `op`= *e2* form behaves as *e1* *= e1* `op` *e2*, but *e1* is evaluated only once.
163+
The *e1* *op*= *e2* form behaves as *e1* **=** *e1* *op* *e2*, but *e1* is evaluated only once.
166164

167165
Compound assignment to an enumerated type generates an error message. If the left operand is of a pointer type, the right operand must be of a pointer type or it must be a constant expression that evaluates to 0. If the left operand is of an integral type, the right operand must not be of a pointer type.
168166

@@ -176,4 +174,4 @@ In ANSI C, the result of an assignment expression is not an l-value. Therefore,
176174

177175
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)<br/>
178176
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)<br/>
179-
[C Assignment Operators](../c-language/c-assignment-operators.md)
177+
[C Assignment Operators](../c-language/c-assignment-operators.md)

0 commit comments

Comments
 (0)