|
Boost : |
Subject: Re: [boost] [safe_numerics] One more review
From: John McFarlane (john_at_[hidden])
Date: 2017-03-11 18:13:53
On Sat, Mar 11, 2017 at 9:23 AM Robert Ramey via Boost <
boost_at_[hidden]> wrote:
> On 3/11/17 7:52 AM, Steven Watanabe via Boost wrote:
> > AMDG
> >
> > On 03/11/2017 02:00 AM, Antony Polukhin via Boost wrote:
> >>
> >> I'd like to see an additional statefull ExceptionPolicy that remembers
> >> that an UB was triggered, but does not throw at all. Here's how it
> >> could be used:
> >>
> >
> > This also requires an extra function to combine two
> > ExceptionPolicies for binary operators. You'll
> > run into problems with comparison operators,
> > though, as a bool can't hold an ExceptionPolicy.
>
> Couldn't the addressed by a variation of the "ignore exception" policy
> which is meant to just return?
>
> A simple extension to log such errors could be crafted from this idea
> and would make a great example on how to make one's own exception policy.
>
> What is missing from this idea?
>
> The solution I favor is for `std::common_type` to be specialized for
allowed combinations. For example, `std::common_type_t<ExceptionPolicy,
T>`, would be `ExceptionPolicy` and `std::common_type_t<UbPolicy, T>` would
be `T`. Thus, safer types would "win out" over less safe types.
>
> >
> > In Christ,
> > Steven Watanabe
> >
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
> >
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk