Why will std::uncaught_exception change to std::uncaught_exceptions?

前端 未结 3 2019
伪装坚强ぢ
伪装坚强ぢ 2020-12-15 07:49

I just noticed over on

http://en.cppreference.com/w/cpp/error/uncaught_exception

that C++17 will replace std::uncaught_exception(), which return

3条回答
  •  再見小時候
    2020-12-15 08:25

    std::uncaught_exception() only detects whether the stack is unwinding. In a paper by Herb Sutter, he points out that this does not reliably indicate that there is an active exception. Herb opines that this is "almost" useful. I have encountered a situation where this is indeed ambiguous, which is what led me to this post.

    std::uncaught_exceptions() is specified as returning the number of active exceptions, which is actually useful.

提交回复
热议问题