|
Boost : |
Subject: Re: [boost] [review] Review of Outcome v2 (Fri-19-Jan to Sun-28-Jan, 2018)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2018-02-06 07:27:49
2018-02-06 1:00 GMT+01:00 Rob Stewart via Boost <boost_at_[hidden]>:
> On February 5, 2018 3:43:49 AM EST, Andrzej Krzemienski via Boost <
> boost_at_[hidden]> wrote:
>
> > Let me expand on this a bit. I have the following program where I save
> > the result, but not inspect it:
> >
> > ```
> > #include "outcome.hpp"
> > namespace out = OUTCOME_V2_NAMESPACE;
> >
> > out::result<void> fun() { return out::success(); }
> >
> > int main()
> > {
> > auto r = fun();
> > }
> > ```
> >
> > When I compile with clang, with -Wall -Wextra -Werror, I get an error
> > saying, "unused variable 'r'". See online examle:
> > https://wandbox.org/permlink/WE7dK6r5XCIxJ83f
> >
> > When I compile with GCC, I do not get this warning. But in my work, w
> > compile programs with GCC, but still use clang for the static analysis
> > pass, and nonetheless this bug would be detected.
>
> IOW, one must use certain tools and options to get the protection.
>
> I think the library could, at least, assert in debug builds when a result
> or outcome is not inspected.
>
Yes, that sounds like a useful addition.
Regards,
&rzej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk