[config] std::uncaught_exceptions
Hello all, std::uncaught_exception (singular) is deprecated in C++17 and will be removed in C++20. std::std::uncaught_exceptions (plural) should be used instead. Will Boost.Config have a macro to detect if std::uncaught_exceptions is supported or not by the current compiler? (For example, Boost.Contract implementation uses std::uncaught_exception and it will need to use std::uncaught_exceptions on C++20 compilers instead.) Thanks. --Lorenzo
On 11/5/18 6:41 AM, Lorenzo Caminiti via Boost wrote:
Hello all,
std::uncaught_exception (singular) is deprecated in C++17 and will be removed in C++20. std::std::uncaught_exceptions (plural) should be used instead.
Will Boost.Config have a macro to detect if std::uncaught_exceptions is supported or not by the current compiler?
(For example, Boost.Contract implementation uses std::uncaught_exception and it will need to use std::uncaught_exceptions on C++20 compilers instead.)
Since you have to include <exception> anyway, you could test for __cpp_lib_uncaught_exceptions. BTW, there are ways to implement std::uncaught_exceptions on some pre-C++17 compilers, this is implemented in Boost.Log: https://github.com/boostorg/log/blob/develop/src/unhandled_exception_count.c... It might be a good idea to move that code somewhere for public use, e.g. in Boost.Exception. Opinions?
On Mon, Nov 5, 2018 at 1:53 AM Andrey Semashev via Boost
wrote: On 11/5/18 6:41 AM, Lorenzo Caminiti via Boost wrote:
Will Boost.Config have a macro to detect if std::uncaught_exceptions is supported or not by the current compiler?
Since you have to include <exception> anyway, you could test for __cpp_lib_uncaught_exceptions.
Yes, this will work well for Boost.Contract. I'll make this change in one of the next releases. Thanks. --Lorenzo
On 11/5/18 12:53 PM, Andrey Semashev wrote:
BTW, there are ways to implement std::uncaught_exceptions on some pre-C++17 compilers, this is implemented in Boost.Log:
https://github.com/boostorg/log/blob/develop/src/unhandled_exception_count.c...
It might be a good idea to move that code somewhere for public use, e.g. in Boost.Exception. Opinions?
FYI, this code is now extracted for public use in Boost.Core: https://github.com/boostorg/core/blob/develop/include/boost/core/uncaught_ex...
participants (2)
-
Andrey Semashev
-
Lorenzo Caminiti