You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/error-messages/compiler-warnings/compiler-warning-level-4-c4702.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
---
2
2
description: "Learn more about: Compiler Warning (level 4) C4702"
3
3
title: "Compiler Warning (level 4) C4702"
4
-
ms.date: "11/04/2016"
4
+
ms.date: 09/20/2021
5
5
f1_keywords: ["C4702"]
6
6
helpviewer_keywords: ["C4702"]
7
7
ms.assetid: d8198c1e-8762-42a6-9e6b-cb568b7a1686
8
8
---
9
9
# Compiler Warning (level 4) C4702
10
10
11
-
unreachable code
11
+
> unreachable code
12
12
13
-
This warning is the result of compiler conformance work that was done for Visual Studio .NET 2003: unreachable code. When the compiler (back end) detects unreachable code, it will generate C4702, a level 4 warning.
13
+
When the compiler back end detects unreachable code, it generates C4702 as a level 4 warning.
14
14
15
-
For code that is valid in both the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++, remove the unreachable code or assure that all source code is reachable by some flow of execution.
15
+
To address this warning, remove the unreachable code or assure that all source code is reachable by some flow of execution.
16
16
17
17
## Examples
18
18
19
-
The following sample generates C4702.
19
+
The following sample generates C4702. To fix it, remove the unreachable code.
20
20
21
21
```cpp
22
22
// C4702.cpp
@@ -29,11 +29,11 @@ int main() {
29
29
}
30
30
```
31
31
32
-
When compiling with **/GX**, **/EHc**, **/EHsc**, or **/EHac** and using extern C functions, code can become unreachable because extern C functions are assumed to not throw, thus the catch block isn't reachable. If you feel that this warning is not valid because a function can throw, compile with **/EHa** or **/EHs**, depending on the exception thrown.
32
+
Error C4702 can occur in some versions of the compiler when you compile using the **`/GX`**, **`/EHc`**, **`/EHsc`**, or **`/EHac`**options, and use `extern "C"` functions. Because the compiler assumes `extern "C"` functions don't throw, the catch block isn't reachable. If you feel that this warning isn't valid because a function can throw, compile with **`/EHa`** or **`/EHs`**, depending on the exception thrown.
33
33
34
-
For more information, see [/EH (Exception Handling Model)](../../build/reference/eh-exception-handling-model.md) for more information.
34
+
For more information, see [`/EH` (Exception Handling Model)](../../build/reference/eh-exception-handling-model.md).
0 commit comments