Skip to content

Commit e04f2b9

Browse files
author
Colin Robertson
committed
Fix more __try keywords
1 parent 664f13d commit e04f2b9

9 files changed

Lines changed: 27 additions & 22 deletions

docs/build/exception-handling-x64.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ typedef struct _DISPATCHER_CONTEXT {
297297
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
298298
```
299299
300-
**ControlPc** is the value of RIP within this function. This value is either an exception address or the address at which control left the establishing function. The RIP is used to determine if control is within some guarded construct inside this function, for example, a `__try` block for `__try`/**`__except`** or `__try`/**`__finally`**.
300+
**ControlPc** is the value of RIP within this function. This value is either an exception address or the address at which control left the establishing function. The RIP is used to determine if control is within some guarded construct inside this function, for example, a **`__try`** block for **`__try`**/**`__except`** or **`__try`**/**`__finally`**.
301301
302302
**ImageBase** is the image base (load address) of the module containing this function, to be added to the 32-bit offsets used in the function entry and unwind info to record relative addresses.
303303

docs/dotnet/exceptions-in-cpp-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ The articles in this section of the documentation explain exception handling in
1414
|[Basic Concepts in Using Managed Exceptions](../dotnet/basic-concepts-in-using-managed-exceptions.md)|Discusses exception handling in managed applications.|
1515
|[Differences in Exception Handling Behavior Under /CLR](../dotnet/differences-in-exception-handling-behavior-under-clr.md)|Discusses the differences between standard exception handling and exception handling in C++/CLI.|
1616
|[finally](../dotnet/finally.md)|Describes the **`finally`** block that's used to clean up resources that are left after an exception occurs.|
17-
|[How to: Catch Exceptions in Native Code Thrown from MSIL](../dotnet/how-to-catch-exceptions-in-native-code-thrown-from-msil.md)|Demonstrates how to use `__try` and **`__except`** to catch exceptions in native code that are thrown from MSIL.|
17+
|[How to: Catch Exceptions in Native Code Thrown from MSIL](../dotnet/how-to-catch-exceptions-in-native-code-thrown-from-msil.md)|Demonstrates how to use **`__try`** and **`__except`** to catch exceptions in native code that are thrown from MSIL.|
1818
|[How to: Define and Install a Global Exception Handler](../dotnet/how-to-define-and-install-a-global-exception-handler.md)|Demonstrates how to capture unhandled exceptions.|
1919
|[.NET Programming with C++/CLI (Visual C++)](../dotnet/dotnet-programming-with-cpp-cli-visual-cpp.md)|The top-level article for .NET programming in the Visual C++ documentation.|

docs/dotnet/how-to-catch-exceptions-in-native-code-thrown-from-msil.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.assetid: c15afd2b-8505-43bf-8a4a-f1d41532a124
66
---
77
# How to: Catch Exceptions in Native Code Thrown from MSIL
88

9-
In native code, you can catch native C++ exception from MSIL. You can catch CLR exceptions with `__try` and **`__except`**.
9+
In native code, you can catch native C++ exception from MSIL. You can catch CLR exceptions with **`__try`** and **`__except`**.
1010

1111
For more information, see [Structured Exception Handling (C/C++)](../cpp/structured-exception-handling-c-cpp.md) and [Modern C++ best practices for exceptions and error handling](../cpp/errors-and-exception-handling-modern-cpp.md).
1212

docs/error-messages/compiler-errors-2/compiler-error-c2702.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
title: "Compiler Error C2702"
3-
ms.date: "11/04/2016"
3+
description: "Describes Microsoft C/C++ compiler error C2702."
4+
ms.date: 08/25/2020
45
f1_keywords: ["C2702"]
56
helpviewer_keywords: ["C2702"]
67
ms.assetid: 6def15d4-9a8d-43e7-ae35-42d7cb57c27e
78
---
89
# Compiler Error C2702
910

10-
__except may not appear in termination block
11+
> `__except` may not appear in termination block
1112
12-
An exception handler (`__try`/**`__except`**) cannot be nested inside a **`__finally`** block.
13+
An exception handler (**`__try`**/**`__except`**) cannot be nested inside a **`__finally`** block.
1314

1415
The following sample generates C2702:
1516

docs/error-messages/compiler-errors-2/compiler-error-c2705.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.assetid: 29249ea3-4ea7-4105-944b-bdb83e8d6852
99

1010
'label' : illegal jump into 'exception handler block' scope
1111

12-
Execution jumps to a label within a **`try`**/**`catch`**, `__try`/**`__except`**, `__try`/**`__finally`** block. For more information, see [Exception Handling](../../cpp/exception-handling-in-visual-cpp.md).
12+
Execution jumps to a label within a **`try`**/**`catch`**, **`__try`**/**`__except`**, **`__try`**/**`__finally`** block. For more information, see [Exception Handling](../../cpp/exception-handling-in-visual-cpp.md).
1313

1414
The following sample generates C2705:
1515

docs/error-messages/compiler-errors-2/compiler-error-c2706.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
title: "Compiler Error C2706"
3-
ms.date: "11/04/2016"
3+
description: "Describes Microsoft C/C++ compiler error C2706."
4+
ms.date: 08/25/2020
45
f1_keywords: ["C2706"]
56
helpviewer_keywords: ["C2706"]
67
ms.assetid: e18da924-c42d-4b09-8e29-f4e0382d7dc6
78
---
89
# Compiler Error C2706
910

10-
illegal __except without matching \__try (missing '}' in \__try block?)
11+
> illegal `__except` without matching `__try` (missing '}' in `__try` block?)
1112
12-
The compiler did not find a closing brace for a `__try` block.
13+
The compiler did not find a closing brace for a **`__try`** block.
1314

1415
The following sample generates C2706:
1516

docs/error-messages/compiler-errors-2/compiler-error-c2712.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
22
title: "Compiler Error C2712"
3-
ms.date: "11/04/2016"
3+
description: "Describes Microsoft C/C++ compiler error C2712."
4+
ms.date: 08/25/2020
45
f1_keywords: ["C2712"]
56
helpviewer_keywords: ["C2712"]
67
ms.assetid: f7d4ffcc-7ed2-459b-8067-a728ce647071
78
---
89
# Compiler Error C2712
910

10-
> cannot use __try in functions that require object unwinding
11+
> cannot use `__try` in functions that require object unwinding
1112
1213
## Remarks
1314

14-
Error C2712 can occur if you use [/EHsc](../../build/reference/eh-exception-handling-model.md), and a function with structured exception handling also has objects that require unwinding (destruction).
15+
Error C2712 can occur if you use [`/EHsc`](../../build/reference/eh-exception-handling-model.md), and a function with structured exception handling also has objects that require unwinding (destruction).
1516

1617
Possible solutions:
1718

@@ -21,11 +22,11 @@ Possible solutions:
2122

2223
- Compile without /EHsc
2324

24-
Error C2712 can also occur if you call a method declared by using the [__event](../../cpp/event.md) keyword. Because the event might be used in a multithreaded environment, the compiler generates code that prevents manipulation of the underlying event object, and then encloses the generated code in an SEH [try-finally statement](../../cpp/try-finally-statement.md). Consequently, error C2712 will occur if you call the event method and pass by value an argument whose type has a destructor. One solution in this case is to pass the argument as a constant reference.
25+
Error C2712 can also occur if you call a method declared by using the [`__event`](../../cpp/event.md) keyword. Because the event might be used in a multithreaded environment, the compiler generates code that prevents manipulation of the underlying event object, and then encloses the generated code in an SEH [`try-finally` statement](../../cpp/try-finally-statement.md). Consequently, error C2712 will occur if you call the event method and pass by value an argument whose type has a destructor. One solution in this case is to pass the argument as a constant reference.
2526

26-
C2712 can also occur if you compile with **/clr:pure** and declare a static array of pointers-to-functions in a `__try` block. A static member requires the compiler to use dynamic initialization under **/clr:pure**, which implies C++ exception handling. However, C++ exception handling is not allowed in a `__try` block.
27+
C2712 can also occur if you compile with **`/clr:pure`** and declare a static array of pointers-to-functions in a **`__try`** block. A static member requires the compiler to use dynamic initialization under **`/clr:pure`**, which implies C++ exception handling. However, C++ exception handling is not allowed in a **`__try`** block.
2728

28-
The **/clr:pure** and **/clr:safe** compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.
29+
The **`/clr:pure`** and **`/clr:safe`** compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.
2930

3031
## Example
3132

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
title: "Compiler Error C2713"
3-
ms.date: "11/04/2016"
3+
description: "Describes Microsoft C/C++ compiler error C2713."
4+
ms.date: 08/25/2020
45
f1_keywords: ["C2713"]
56
helpviewer_keywords: ["C2713"]
67
ms.assetid: bae9bee3-b4b8-4be5-b6a5-02df587a7278
78
---
89
# Compiler Error C2713
910

10-
only one form of exception handling permitted per function
11+
> only one form of exception handling permitted per function
1112
12-
You cannot use structured exception handling (`__try`/**`__except`**) and C++ exception handling (**`try`**/**`catch`**) in the same function.
13+
You can't use structured exception handling (**`__try`**/**`__except`**) and C++ exception handling (**`try`**/**`catch`**) in the same function.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
title: "Compiler Warning (level 4) C4932"
3-
ms.date: "11/04/2016"
3+
description: "Describes Microsoft C/C++ compiler warning C4932."
4+
ms.date: 08/25/2020
45
f1_keywords: ["C4932"]
56
helpviewer_keywords: ["C4932"]
67
ms.assetid: 0b8d88cc-21f6-45cb-a9f5-1795b7db0dfa
78
---
89
# Compiler Warning (level 4) C4932
910

10-
__identifier(identifier) and \__identifier(identifier) are indistinguishable
11+
> `__identifier(identifier_1)` and `__identifier(identifier_2)` are indistinguishable
1112
12-
The compiler is unable to distinguish between **_finally** and **`__finally`** or `__try` and **_try** as a parameter passed to [__identifier](../../extensions/identifier-cpp-cli.md). You should not attempt to use them both as identifiers in the same program, as it will result in a [C2374](../../error-messages/compiler-errors-1/compiler-error-c2374.md) error.
13+
The compiler is unable to distinguish between **`_finally`** and **`__finally`** or **`__try`** and **`_try`** as a parameter passed to [`__identifier`](../../extensions/identifier-cpp-cli.md). You should not attempt to use them both as identifiers in the same program, as it will result in a [C2374](../../error-messages/compiler-errors-1/compiler-error-c2374.md) error.
1314

1415
The following sample generates C4932:
1516

0 commit comments

Comments
 (0)