Skip to content

Commit edc5e7f

Browse files
committed
put back (()) example
1 parent b91165c commit edc5e7f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4706.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: Compiler Warning (level 4) C4706"
33
title: "Compiler Warning (level 4) C4706"
4-
ms.date: "3/4/2025"
4+
ms.date: "3/5/2025"
55
f1_keywords: ["C4706"]
66
helpviewer_keywords: ["C4706"]
77
---
@@ -20,7 +20,20 @@ The following sample generates C4706:
2020
int main()
2121
{
2222
int a = 0, b = 0;
23-
if ( a = b ) // C4706
23+
if (a = b) // C4706
24+
{
25+
}
26+
}
27+
```
28+
29+
Suppress the warning with `((expression))`. For example:
30+
31+
```cpp
32+
// compile with: /W4
33+
int main()
34+
{
35+
int a = 0, b = 0;
36+
if ((a = b)) // No warning
2437
{
2538
}
2639
}
@@ -33,7 +46,7 @@ If your intention is to test a relation, not to make an assignment, use the `==`
3346
int main()
3447
{
3548
int a = 0, b = 0;
36-
if ( a == b )
49+
if (a == b)
3750
{
3851
}
3952
}
@@ -46,7 +59,7 @@ If you intend to make your test value the result of an assignment, test to ensur
4659
int main()
4760
{
4861
int a = 0, b = 0;
49-
if (( a = b ) != 0 )
62+
if ((a = b) != 0)
5063
{
5164
}
5265
}

0 commit comments

Comments
 (0)