Skip to content

Commit 9682b75

Browse files
author
Colin Robertson
authored
Address cpp-docs 3378 (#3782)
1 parent 5cf10dd commit 9682b75

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
description: "Learn more about: Compiler Warning (level 4) C4702"
33
title: "Compiler Warning (level 4) C4702"
4-
ms.date: "11/04/2016"
4+
ms.date: 09/20/2021
55
f1_keywords: ["C4702"]
66
helpviewer_keywords: ["C4702"]
77
ms.assetid: d8198c1e-8762-42a6-9e6b-cb568b7a1686
88
---
99
# Compiler Warning (level 4) C4702
1010

11-
unreachable code
11+
> unreachable code
1212
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.
1414

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.
1616

1717
## Examples
1818

19-
The following sample generates C4702.
19+
The following sample generates C4702. To fix it, remove the unreachable code.
2020

2121
```cpp
2222
// C4702.cpp
@@ -29,11 +29,11 @@ int main() {
2929
}
3030
```
3131

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.
3333

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).
3535

36-
The following sample generates C4702.
36+
The following sample generates C4702:
3737

3838
```cpp
3939
// C4702b.cpp

0 commit comments

Comments
 (0)