全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Exception, throw, handler?

又称: exception (C++) · throw expression · handler (exception)

Definition 1.14 University Computer Science — Year 2 · 第 1 章 — From C to C++: Classes and Resource Management

An exception is an object that reports an error. A throw expression throw e; stops the current function and starts the search for a handler. A try block is followed by one or more handlers catch (const T &x) {body}: the first handler, in order, whose type T is the type of the exception or one of its base classes catches it. catch (...) catches anything, and throw; inside a handler throws the same exception again. If no handler catches it, the program ends.

在原文中阅读 →