Error handling
来自cppreference.com
< cpp
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
[编辑] 异常处理
头
<exception>提供了一些相关的类和函数的C + +程序中的异常处理.Original:
The header
<exception> provides several classes and functions related to exception handling in C++ programs.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Defined in header
<exception> | |
| 标准库组件抛出的异常的基类 Original: base class for exceptions thrown by the standard library components The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
Original: Capture and storage of exception objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 检查,如果异常处理是目前正在进行中 Original: checks if exception handling is currently in progress The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
| (C++11) |
处理异常对象的共享指针类型 Original: shared pointer type for handling exception objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) |
| (C++11) |
创建一个异常对象的std::exception_ptr Original: creates an std::exception_ptr from an exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (C++11) |
captures the current exception in a std::exception_ptr (函数) |
| (C++11) |
从std::exception_ptr抛出的异常 Original: throws the exception from an std::exception_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
一个mixin捕获和存储当前的异常的类型 Original: a mixin type to capture and store current exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| (C++11) |
std::nested_exception混合 Original: throws its argument with std::nested_exception mixed in The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (C++11) |
从std::nested_exception抛出的异常 Original: throws the exception from a std::nested_exception The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
Original: Handling of failures in exception handling The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 异常处理函数调用时失败 Original: function called when exception handling fails The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
| std::terminate所调用的函数的类型的 Original: the type of the function called by std::terminate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) | |
| (C++11) |
获得电流terminate_handler Original: obtains the current terminate_handler The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| 改变功能被称为由std::terminate Original: changes the function to be called by std::terminate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
Original: Handling of exception specification violations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (过时了) |
函数调用动态的异常规范被违反时 Original: function called when dynamic exception specification is violated The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| 时抛出的异常动态异常规范被违反时,如果可能的话 Original: exception thrown when dynamic exception specification is violated, if possible The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| (过时了) |
std::unexpected所调用的函数的类型的 Original: the type of the function called by std::unexpected The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) |
| (C++11)(过时了) |
获得电流unexpected_handler Original: obtains the current unexpected_handler The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (过时了) |
改变功能被称为由std::unexpected Original: changes the function to be called by std::unexpected The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
[编辑] 异常类
预定义了一些方便的类在头
<stdexcept>报告特定的错误条件。这些类可以分为两类:“逻辑”错误“运行时”错误。逻辑错误的结果,在程序中的逻辑错误,是可以预防的。运行时错误是由于不可抗力事件的范围,该方案不容易被预测.Original:
Several convenience classes are predefined in the header
<stdexcept> to report particular error conditions. These classes can be divided into two categories: logic errors and runtime errors. Logic errors are a consequence of faulty logic within the program and may be preventable. Runtime errors are due to events beyond the scope of the program and can not be easily predicted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Defined in header
<stdexcept> | |
| 异常类,指示违反了逻辑前提或类不变量 Original: exception class to indicate violations of logical preconditions or class invariants The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类报告无效的参数 Original: exception class to report invalid arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类报告域错误 Original: exception class to report domain errors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类报告试图超过允许的最大大小 Original: exception class to report attempts to exceed maximum allowed size The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类报告的预期范围之外的参数 Original: exception class to report arguments outside of expected range The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类,表示只有在运行时检测到的条件 Original: exception class to indicate conditions only detectable at run time The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 异常类报表范围的内部计算错误 Original: exception class to report range errors in internal computations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 报告算术溢出的异常类 Original: exception class to report arithmetic overflows The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 报告算术下溢的异常类 Original: exception class to report arithmetic underflows The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
[编辑] 错误号
| Defined in header
<cerrno> | |
| 宏扩展到本地POSIX兼容线程错误号variable
(宏变量) Original: macro which expands to POSIX-compatible thread-local error number variable (宏变量) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 宏为标准的POSIX兼容的错误条件 Original: macros for standard POSIX-compatible error conditions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) | |
[编辑] 断言
断言帮助实现的前提条件检查程序中的.
Original:
Assertions help to implement checking of preconditions in programs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| 静态断言 | 检查(C++11 起)进行编译时断言
Original: performs compile-time assertion checking (C++11 起) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| Defined in header
<cassert> | |
| 如果用户指定的条件是不true中止该程序。发布版本中可能会被禁用 Original: aborts the program if the user-specified condition is not true. May be disabled for release builds The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数宏) | |
[编辑] 系统错误
头
<system_error>定义用于报告错误情况,从操作系统的类型和功能,数据流I / O,std::future,或其他低级别的API.Original:
The header
<system_error> defines types and functions used to report error conditions originating from the operating system, streams I/O, std::future, or other low-level APIs.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Defined in header
<system_error> | |
| (C++11) |
错误类型的基类 Original: base class for error categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| (C++11) |
标识通用的错误类别 Original: identifies the generic error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
识别操作系统错误类别 Original: identifies the operating system error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
持有便携式的错误代码 Original: holds a portable error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| (C++11) |
std::error_condition列出所有标准 <cerrno>宏常量枚举Original: the std::error_condition enumeration listing all standard <cerrno> macro constantsThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| (C++11) |
持有与平台相关的错误代码 Original: holds a platform-dependent error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| (C++11) |
使用异常类报告有一个ERROR_CODE的条件 Original: exception class used to report conditions that have an error_code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |