Skip to content

Commit ce43512

Browse files
author
mikeblome
committed
initial rework of exceptions node
1 parent 15846c5 commit ce43512

5 files changed

Lines changed: 44 additions & 75 deletions

File tree

docs/build/reference/exceptions-c-cpp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Exceptions (C/C++)"
3-
ms.date: "11/04/2016"
2+
title: "DLL loading exception codes (C/C++)"
3+
ms.date: "11/19/2019"
44
f1_keywords: ["ERROR_MOD_NOT_FOUND", "vcppException", "ERROR_SEVERITY_ERROR"]
55
helpviewer_keywords: ["vcppException", "C++ exception handling, delayed loading of DLLs", "delayed loading of DLLs, exceptions", "ERROR_SEVERITY_ERROR exception", "ERROR_MOD_NOT_FOUND exception"]
66
ms.assetid: c03be05d-1c39-4f35-84cf-00c9af3bae9a

docs/cpp/cpp-exception-handling.md

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "Exception Handling in MSVC"
3-
ms.date: "05/07/2019"
3+
ms.date: "11/19/2019"
44
helpviewer_keywords: ["try-catch keyword [C++], exception handling"]
55
ms.assetid: a6aa08de-669d-4ce8-9ec3-ec20d1354fcf
66
---
77
# Exception Handling in MSVC
88

9-
An exception is an error condition, possibly outside the program's control, that prevents the program from continuing along its regular execution path. Certain operations, including object creation, file input/output, and function calls made from other modules, are all potential sources of exceptions even when your program is running correctly. Robust code anticipates and handles exceptions.
9+
An exception is an error condition, possibly outside the program's control, that prevents the program from continuing along its regular execution path. Certain operations, including object creation, file input/output, and function calls made from other modules, are all potential sources of exceptions even when your program is running correctly. Robust code anticipates and handles exceptions. To detect logic errors, use assertions rather than exceptions (see [Using Assertions](/visualstudio/debugger/c-cpp-assertions)).
1010

11-
To detect logic errors within a single program or module, use assertions rather than exceptions (see [Using Assertions](/visualstudio/debugger/c-cpp-assertions)).
11+
## Kinds of exceptions
1212

1313
The Microsoft C++ compiler (MSVC) supports three kinds of exception handling:
1414

@@ -22,14 +22,26 @@ The Microsoft C++ compiler (MSVC) supports three kinds of exception handling:
2222

2323
- [MFC exceptions](../mfc/exception-handling-in-mfc.md)
2424

25-
Since version 3.0, MFC has used C++ exceptions but still supports its older exception handling macros, which are similar to C++ exceptions in form. Although these macros are not recommended for new programming, they are still supported for backward compatibility. In programs that already use the macros, you can freely use C++ exceptions as well. During preprocessing, the macros evaluate to the exception handling keywords defined in the MSVC implementation of the C++ language as of Visual C++ version 2.0. You can leave existing exception macros in place while you begin to use C++ exceptions.
26-
2725
Use the [/EH](../build/reference/eh-exception-handling-model.md) compiler option to specify the type of exception handling to use in a project; C++ exception handling is the default. Do not mix the error handling mechanisms; for example, do not use C++ exceptions with structured exception handling. Using C++ exception handling makes your code more portable, and it allows you to handle exceptions of any type. For more information about the drawbacks of structured exception handling, see [Structured Exception Handling](../cpp/structured-exception-handling-c-cpp.md). For advice about mixing MFC macros and C++ exceptions, see [Exceptions: Using MFC Macros and C++ Exceptions](../mfc/exceptions-using-mfc-macros-and-cpp-exceptions.md).
2826

29-
For information on handling exceptions in CLR applications, see [Exception Handling (C++/CLI and C++/CX)](../extensions/exception-handling-cpp-component-extensions.md).
27+
## In this section
28+
29+
- [The try, catch, and throw Statements](../cpp/try-throw-and-catch-statements-cpp.md)
30+
31+
- [How Catch Blocks are Evaluated](../cpp/how-catch-blocks-are-evaluated-cpp.md)
32+
33+
- [Exceptions and Stack Unwinding](../cpp/exceptions-and-stack-unwinding-in-cpp.md)
34+
35+
- [Exception Specifications](../cpp/exception-specifications-throw-cpp.md)
36+
37+
- [noexcept](../cpp/noexcept-cpp.md)
38+
39+
- [Unhandled C++ Exceptions](../cpp/unhandled-cpp-exceptions.md)
3040

31-
For information about exception handling on x64 processors, see [x64 exception handling](../build/exception-handling-x64.md).
41+
- [Mixing C (Structured) and C++ Exceptions](../cpp/mixing-c-structured-and-cpp-exceptions.md)
3242

3343
## See also
3444

35-
[C++ Language Reference](../cpp/cpp-language-reference.md)
45+
[C++ Language Reference](../cpp/cpp-language-reference.md)</br>
46+
[x64 exception handling](../build/exception-handling-x64.md)</br>
47+
[Exception Handling (C++/CLI and C++/CX)](../extensions/exception-handling-cpp-component-extensions.md)

docs/mfc/exception-handling-in-mfc.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Exception Handling in MFC"
3-
ms.date: "11/04/2016"
3+
ms.date: "11/19/2019"
44
helpviewer_keywords: ["DAO [MFC], exceptions", "assertions [MFC], When to use exceptions", "exception handling [MFC], MFC", "resource allocation exception", "resources [MFC], allocating", "keywords [MFC], exception handling", "errors [MFC], detected by assertions", "ODBC exceptions [MFC]", "serialization [MFC], exceptions", "Automation [MFC], exceptions", "exception macros [MFC]", "predefined exceptions [MFC]", "C++ exception handling [MFC], enabling", "C++ exception handling [MFC], MFC applications", "requests for unsupported services [MFC]", "database exceptions [MFC]", "archive exceptions [MFC]", "MFC, exceptions", "C++ exception handling [MFC], types of", "macros [MFC], exception handling", "abnormal program execution [MFC]", "OLE exceptions [MFC], MFC exception handling", "error handling [MFC], exceptions and", "class libraries [MFC], exception support", "exceptions [MFC], MFC macros vs. C++ keywords", "memory [MFC], out-of-memory exceptions", "Windows [MFC], resource allocation exceptions", "macros [MFC], MFC exception macros", "function calls [MFC], results", "out-of-memory exceptions [MFC]"]
55
ms.assetid: 0926627d-2ba7-44a6-babe-d851a4a2517c
66
---
@@ -66,8 +66,7 @@ The following table shows the predefined exceptions provided by MFC.
6666
|[COleDispatchException Class](../mfc/reference/coledispatchexception-class.md)|Dispatch (automation) exceptions|
6767
|[CUserException Class](../mfc/reference/cuserexception-class.md)|Exception that alerts the user with a message box, then throws a generic [CException Class](../mfc/reference/cexception-class.md)|
6868

69-
> [!NOTE]
70-
> MFC supports both C++ exceptions and the MFC exception macros. MFC does not directly support Windows NT structured exception handlers (SEH), as discussed in [Structured Exception Handling](/windows/win32/debug/structured-exception-handling).
69+
Since version 3.0, MFC has used C++ exceptions but still supports its older exception handling macros, which are similar to C++ exceptions in form. Although these macros are not recommended for new programming, they are still supported for backward compatibility. In programs that already use the macros, you can freely use C++ exceptions as well. During preprocessing, the macros evaluate to the exception handling keywords defined in the MSVC implementation of the C++ language as of Visual C++ version 2.0. You can leave existing exception macros in place while you begin to use C++ exceptions. For information on mixing macros and C++ exception handling and on converting old code to use the new mechanism, see the articles [Exceptions: Using MFC Macros and C++ Exceptions](../mfc/exceptions-using-mfc-macros-and-cpp-exceptions.md) and [Exceptions: Converting from MFC Exception Macros](../mfc/exceptions-converting-from-mfc-exception-macros.md). The older MFC exception macros, if you still use them, evaluate to C++ exception keywords. See [Exceptions: Changes to Exception Macros in Version 3.0](../mfc/exceptions-changes-to-exception-macros-in-version-3-0.md). MFC does not directly support Windows NT structured exception handlers (SEH), as discussed in [Structured Exception Handling](/windows/win32/debug/structured-exception-handling).
7170

7271
## <a name="_core_further_reading_about_exceptions"></a> Further Reading About Exceptions
7372

docs/toc.yml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,32 +4260,27 @@
42604260
items:
42614261
- name: Exception handling in C++
42624262
href: cpp/exception-handling-in-visual-cpp.md
4263-
- name: Exception handling
4264-
expanded: false
4265-
items:
4266-
- name: Exception handling
4267-
href: cpp/cpp-exception-handling.md
4268-
- name: try, throw, and catch statements
4269-
href: cpp/try-throw-and-catch-statements-cpp.md
4270-
- name: How catch blocks are evaluated
4271-
href: cpp/how-catch-blocks-are-evaluated-cpp.md
4272-
- name: Exceptions and stack unwinding in C++
4273-
href: cpp/exceptions-and-stack-unwinding-in-cpp.md
4274-
- name: Exception specifications (throw)
4275-
href: cpp/exception-specifications-throw-cpp.md
4276-
- name: noexcept
4277-
href: cpp/noexcept-cpp.md
4278-
- name: Unhandled C++ exceptions
4279-
href: cpp/unhandled-cpp-exceptions.md
4263+
- name: try, throw, and catch statements
4264+
href: cpp/try-throw-and-catch-statements-cpp.md
4265+
- name: How catch blocks are evaluated
4266+
href: cpp/how-catch-blocks-are-evaluated-cpp.md
4267+
- name: Exceptions and stack unwinding
4268+
href: cpp/exceptions-and-stack-unwinding-in-cpp.md
4269+
- name: Exception specifications (throw)
4270+
href: cpp/exception-specifications-throw-cpp.md
4271+
- name: noexcept
4272+
href: cpp/noexcept-cpp.md
4273+
- name: Unhandled C++ exceptions
4274+
href: cpp/unhandled-cpp-exceptions.md
4275+
- name: Mixing C (Structured) and C++ exceptions
4276+
expanded: false
4277+
items:
42804278
- name: Mixing C (Structured) and C++ exceptions
4281-
expanded: false
4282-
items:
4283-
- name: Mixing C (Structured) and C++ exceptions
4284-
href: cpp/mixing-c-structured-and-cpp-exceptions.md
4285-
- name: Using setjmp-longjmp
4286-
href: cpp/using-setjmp-longjmp.md
4287-
- name: Handle structured exceptions in C++
4288-
href: cpp/exception-handling-differences.md
4279+
href: cpp/mixing-c-structured-and-cpp-exceptions.md
4280+
- name: Using setjmp-longjmp
4281+
href: cpp/using-setjmp-longjmp.md
4282+
- name: Handle structured exceptions in C++
4283+
href: cpp/exception-handling-differences.md
42894284
- name: Structured Exception Handling (SEH) (C/C++)
42904285
expanded: false
42914286
items:

0 commit comments

Comments
 (0)