Skip to content

Commit 69acd37

Browse files
author
Colin Robertson
committed
Add useful links
1 parent 6fb01ef commit 69acd37

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/build/reference/eh-exception-handling-model.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Clears the previous option argument. For example, **`/EHsc-`** is interpreted as
3939

4040
## Remarks
4141

42-
### Default behavior
42+
### Default exception handling behavior
4343

44-
The compiler always generates code that supports asynchronous structured exception handling (SEH). By default (that is, if no **`/EHsc`**, **`/EHs`**, or **`/EHa`** option is specified), the compiler supports SEH handlers in the native C++ `catch(...)` clause. However, it also generates code that only partially supports C++ exceptions. The default exception unwinding code doesn't destroy automatic C++ objects outside of **try** blocks that go out of scope because of an exception. Resource leaks and undefined behavior may result when a C++ exception is thrown.
44+
The compiler always generates code that supports asynchronous structured exception handling (SEH). By default (that is, if no **`/EHsc`**, **`/EHs`**, or **`/EHa`** option is specified), the compiler supports SEH handlers in the native C++ `catch(...)` clause. However, it also generates code that only partially supports C++ exceptions. The default exception unwinding code doesn't destroy automatic C++ objects outside of [try](../../cpp/try-throw-and-catch-statements-cpp.md) blocks that go out of scope because of an exception. Resource leaks and undefined behavior may result when a C++ exception is thrown.
4545

4646
### Standard C++ exception handling
4747

@@ -53,12 +53,12 @@ When you use **`/EHs`** or **`/EHsc`**, the compiler assumes that exceptions can
5353

5454
### Structured and standard C++ exception handling
5555

56-
The **`/EHa`** compiler option enables safe stack unwinding for both asynchronous exceptions and C++ exceptions. It supports handling of both standard C++ and structured exceptions by using the native C++ `catch(...)` clause. To implement SEH without specifying **`/EHa`**, you may use the **__try**, **__except**, and **__finally** syntax.
56+
The **`/EHa`** compiler option enables safe stack unwinding for both asynchronous exceptions and C++ exceptions. It supports handling of both standard C++ and structured exceptions by using the native C++ `catch(...)` clause. To implement SEH without specifying **`/EHa`**, you may use the **__try**, **__except**, and **__finally** syntax. For more information, see [Structured exception handling](../../cpp/structured-exception-handling-c-cpp.md).
5757

5858
> [!IMPORTANT]
5959
> Specifying **`/EHa`** and trying to handle all exceptions by using `catch(...)` can be dangerous. In most cases, asynchronous exceptions are unrecoverable and should be considered fatal. Catching them and proceeding can cause process corruption and lead to bugs that are hard to find and fix.
6060
>
61-
> Even though Windows and Visual C++ support SEH, we strongly recommend that you use ISO-standard C++ exception handling (**`/EHsc`** or **`/EHs`**). It makes your code more portable and flexible. There may still be times you have to use SEH in legacy code or for particular kinds of programs. It's required in code compiled to support the common language runtime ([/clr](clr-common-language-runtime-compilation.md)), for example. For more information, see [Structured Exception Handling (C/C++)](../../cpp/structured-exception-handling-c-cpp.md).
61+
> Even though Windows and Visual C++ support SEH, we strongly recommend that you use ISO-standard C++ exception handling (**`/EHsc`** or **`/EHs`**). It makes your code more portable and flexible. There may still be times you have to use SEH in legacy code or for particular kinds of programs. It's required in code compiled to support the common language runtime ([/clr](clr-common-language-runtime-compilation.md)), for example. For more information, see [Structured exception handling](../../cpp/structured-exception-handling-c-cpp.md).
6262
>
6363
> We recommend that you never link object files compiled using **`/EHa`** to ones compiled using **`/EHs`** or **`/EHsc`** in the same executable module. If you have to handle an asynchronous exception by using **`/EHa`** anywhere in your module, use **`/EHa`** to compile all the code in the module. You can use structured exception handling syntax in the same module as code that's compiled by using **`/EHs`**. However, you can't mix the SEH syntax with C++ **try**, **throw**, and **catch** in the same function.
6464
@@ -115,7 +115,7 @@ The **`/EHr`** option forces runtime termination checks in all functions that ha
115115

116116
A non-throwing attribute isn't a guarantee that exceptions can't be thrown by a function. Unlike the behavior of a **noexcept** function, the MSVC compiler considers an exception thrown by a function declared using `throw()`, `__declspec(nothrow)`, or **extern "C"** as undefined behavior. Functions that use these three declaration attributes don't enforce runtime termination checks for exceptions. You can use the **`/EHr`** option to help you identify this undefined behavior, by forcing the compiler to generate runtime checks for unhandled exceptions that escape a **noexcept** function.
117117

118-
## Set the compiler option in Visual Studio or programmatically
118+
## Set the option in Visual Studio or programmatically
119119

120120
### To set this compiler option in the Visual Studio development environment
121121

0 commit comments

Comments
 (0)