[config] std::uncaught_exceptions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[config] std::uncaught_exceptions

Boost - Dev mailing list
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [config] std::uncaught_exceptions

Boost - Dev mailing list
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.cpp

It might be a good idea to move that code somewhere for public use, e.g.
in Boost.Exception. Opinions?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [config] std::uncaught_exceptions

Boost - Dev mailing list
> On Mon, Nov 5, 2018 at 1:53 AM Andrey Semashev via Boost <[hidden email]> 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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [config] std::uncaught_exceptions

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
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.cpp 
>
> 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_exceptions.hpp

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost