Skip to content

Commit 56a5ce8

Browse files
Merge pull request #5224 from MicrosoftDocs/main638768826716735874sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 80d3b1a + 0df252d commit 56a5ce8

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,65 @@
11
---
22
description: "Learn more about: Compiler Warning (level 4) C4706"
33
title: "Compiler Warning (level 4) C4706"
4-
ms.date: "11/04/2016"
4+
ms.date: "3/5/2025"
55
f1_keywords: ["C4706"]
66
helpviewer_keywords: ["C4706"]
7-
ms.assetid: 89cd3f4f-812c-4a4b-9426-65a5a6d1b99c
87
---
98
# Compiler Warning (level 4) C4706
109

11-
assignment within conditional expression
10+
> assignment used as a condition
1211
13-
The test value in a conditional expression was the result of an assignment.
12+
The test value in a conditional expression is the result of an assignment.
1413

1514
An assignment has a value (the value on the left side of the assignment) that can be used legally in another expression, including a test expression.
1615

1716
The following sample generates C4706:
1817

1918
```cpp
20-
// C4706a.cpp
2119
// compile with: /W4
2220
int main()
2321
{
2422
int a = 0, b = 0;
25-
if ( a = b ) // C4706
23+
if (a = b) // C4706
2624
{
2725
}
2826
}
2927
```
3028

31-
The warning will occur even if you double the parentheses around the test condition:
29+
Suppress the warning with `((`*expression*`))`. For example:
3230

3331
```cpp
34-
// C4706b.cpp
3532
// compile with: /W4
3633
int main()
3734
{
3835
int a = 0, b = 0;
39-
if ( ( a = b ) ) // C4706
36+
if ((a = b)) // No warning
4037
{
4138
}
4239
}
4340
```
4441

45-
If your intention is to test a relation and not to make an assignment, use the `==` operator. For example, the following line tests whether a and b are equal:
42+
If your intention is to test a relation, not to make an assignment, use the `==` operator. For example, the following tests whether a and b are equal:
4643

4744
```cpp
48-
// C4706c.cpp
4945
// compile with: /W4
5046
int main()
5147
{
5248
int a = 0, b = 0;
53-
if ( a == b )
49+
if (a == b)
5450
{
5551
}
5652
}
5753
```
5854

59-
If you intend to make your test value the result of an assignment, test to ensure that the assignment is non-zero or not null. For example, the following code will not generate this warning:
55+
If you intend to make your test value the result of an assignment, test to ensure that the assignment is non-zero or non-null. For example, the following code doesn't generate this warning:
6056

6157
```cpp
62-
// C4706d.cpp
6358
// compile with: /W4
6459
int main()
6560
{
6661
int a = 0, b = 0;
67-
if ( ( a = b ) != 0 )
62+
if ((a = b) != 0)
6863
{
6964
}
7065
}

docs/sanitizers/asan-known-issues.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "AddressSanitizer known issues"
33
description: "Technical description of the AddressSanitizer for Microsoft C/C++ known issues."
4-
ms.date: 1/28/2025
4+
ms.date: 3/5/2025
55
helpviewer_keywords: ["AddressSanitizer known issues"]
66
---
77

@@ -23,8 +23,6 @@ These options and functionality are incompatible with [`/fsanitize=address`](../
2323
- [C++ AMP](../parallel/amp/cpp-amp-overview.md) is unsupported, and should be disabled.
2424
- [Universal Windows Platform](../cppcx/universal-windows-apps-cpp.md) (UWP) applications are unsupported.
2525
- [Special case list](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html) files are unsupported.
26-
- [MFC](../mfc/mfc-concepts.md) using the optional [`alloc_dealloc_mismatch`](error-alloc-dealloc-mismatch.md) runtime option is unsupported.
27-
- [`_CrtDumpMemoryLeaks`](../c-runtime-library/reference/crtdumpmemoryleaks.md) is unsupported, and should be disabled.
2826

2927
## Standard library support
3028

@@ -56,6 +54,12 @@ int main() {
5654
}
5755
```
5856

57+
## Overriding operator new and delete
58+
59+
AddressSanitizer (ASAN) has a custom version of `operator new` and `operator delete` that it uses to find more allocation errors like [`alloc_dealloc_mismatch`](error-alloc-dealloc-mismatch.md). Running the linker with [`/INFERASANLIBS`](../build/reference/inferasanlibs.md) ensures that ASAN's `new`/`delete` override has low precedence, so that the linker chooses any `operator new` or `operator delete` overrides in other libraries over ASAN's custom versions. When this happens, ASAN may not be able to catch some errors that rely on its custom `operator new` and `operator delete`.
60+
61+
[MFC](../mfc/mfc-concepts.md) includes custom overrides for `operator new` and `operator delete` and so might miss errors like [`alloc_dealloc_mismatch`](error-alloc-dealloc-mismatch.md).
62+
5963
## Windows versions
6064

6165
As there are dependencies with specific Windows versions, support is focused on Windows 10. MSVC AddressSanitizer was tested on 10.0.14393 (RS1), and 10.0.21323 (prerelease insider build). [Report a bug](https://aka.ms/feedback/report?space=62) if you run into issues.

0 commit comments

Comments
 (0)