[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] PATCH: use std::uncaught_exceptions()
From: |
Greg Chicares |
Subject: |
Re: [lmi] PATCH: use std::uncaught_exceptions() |
Date: |
Fri, 23 Mar 2018 22:14:02 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 2018-03-23 09:17, Vadim Zeitlin wrote:
>
> I've made a PR with a trivial change replacing the use of
> std::uncaught_exception() (singular, returning bool) with
> std::uncaught_exceptions() (plural, returning int) as the former is
> deprecated in C++17 in favour of the latter and, in practice, MSVS 2017
> warns about this, which is annoying, so it would be nice if you could
> please apply https://github.com/vadz/lmi/pull/76
Cherry-picked; to be pushed after my next complete test.
As usual, I've made my own follow-up changes as a separate commit
(and resisted the urge to git-commit --amend them into your commit).
In 'handle_exceptions.hpp' I've trivially updated this comment:
/// It may seem like a good idea to test std::uncaught_exceptions()
/// right before the try block, as recommended here [these references
/// speak of the related facility deprecated by C++17]:
///
http://groups.google.com/group/comp.lang.c++.moderated/msg/ec0ef69dd3949955
/// "Before the try-block in report_exception, query
/// std::uncaught_exception() to determine if an exception is
/// active. If it is not, throw std::logic_error or some exception
/// that you know that your framework will catch."
/// but actually that's invalid--see:
///
http://groups.google.com/group/comp.lang.c++.moderated/msg/aa7ce713ee90c044
/// "The only problem with uncaught_exception is that it doesn't
/// tell you when you're in a catch(...) { ... throw; } block"
but now I wonder: does this C++17 improvement address exactly the
problem described in the second clc++m citation above? [I tested
those old dejanews links, and they still work.] And if so, should
we change 'handle_exceptions.hpp' (not necessarily right now),
and do you know how to write unit tests to make sure that any such
change makes it both (1) better, and (2) no worse?
I think the last time I looked at std::uncaught_exception[s]() was
over a decade ago, and I concluded then that it wasn't actually
very useful--but I see you've used it in code written since that
time, so you must have a better understanding of it than I do.
- [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/23
- Re: [lmi] PATCH: use std::uncaught_exceptions(),
Greg Chicares <=
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/24
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Greg Chicares, 2018/03/24
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/24
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Greg Chicares, 2018/03/25
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/25
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Greg Chicares, 2018/03/25
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/26
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Greg Chicares, 2018/03/27
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Vadim Zeitlin, 2018/03/27
- Re: [lmi] PATCH: use std::uncaught_exceptions(), Greg Chicares, 2018/03/29