机构地区: 东南大学机械工程学院
出 处: 《兵工自动化》 2006年第10期85-85,共1页
摘 要: 基于C++的异常处理机制,包括异常定义、异常抛出和异常捕获及处理3个步骤,分别对应try、throw及catch代码块3个程序形式。首先C++通过try代码块进行异常定义,再采用throw语句抛出可以是任何类型的异常数据对象,最后用catch代码块对异常进行捕获和处理。该处理机制可增强C++程序的健壮性和容错性。 The exception handling mechanism based on C++ includes exception definition, exception output & capture, and processing; and they were corresponded with the try code block, throw code block and catch code block. At first, the C++ carried out exception definition by Try code block; then, the throw sentence was used to output exception data object of any type; at last, the catch code block was adopted to acquire and deal with the exceptions. This processing mechanism could improved the robustness and tolerance of C++ programmer.
关 键 词: 异常处理机制 程序 异常捕获 异常抛出 数据对象 代码 容错性
领 域: [自动化与计算机技术] [自动化与计算机技术]