【问题标题】:C++ exception overhead and throw instruction [duplicate]C ++异常开销和抛出指令[重复]
【发布时间】:2012-06-08 04:07:23
【问题描述】:

可能重复:
How do exceptions work (behind the scenes) in c++

我知道 try/catch 块会在运行时增加一点开销。但是对于没有 try/catch 块的单个“throw”指令是这样吗?

非常感谢。

【问题讨论】:

    标签: c++ try-catch throw


    【解决方案1】:

    如果 throw 没有 try/cache,那么 throw 是没有意义的,会导致应用崩溃。

    【讨论】:

    • 这不是没有意义的;它为编码器提供了程序执行停止原因的清晰描述,假设编码器使用了打印它的东西。总是有可能错误地超出数组等范围。
    猜你喜欢
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    • 2012-02-22
    • 1970-01-01
    • 2011-10-04
    • 2013-03-23
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多