Boost logo

Boost :

From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2022-04-16 15:59:10


On Sat, Apr 16, 2022 at 10:57 AM Vinnie Falco wrote:
>
> Isn't it better to just write
> (void) x;

Doesn't always work. For example: https://godbolt.org/z/3zn11ErKG

Compare to use of boost::ignore_used: https://godbolt.org/z/Maf4KcPeo

See also Herb's comment:
https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/#comment-1509

For those rare users that can afford to target C++17 or higher, they
have [[maybe_unused]]

Glen

Glen

> instead of including a whole header file:
>
> #include <boost/core/ignore_unused>
>
> just to write
>
> boost::ignore_unused( x );
>
> ?
>
> --
> Regards,
> Vinnie
>
> Follow me on GitHub: https://github.com/vinniefalco
>
> _______________________________________________
> 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