Subject: Re: [boost] How to deal with unused variable with a BOOST_ASSERT check?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-09-09 15:46:08
On 09/09/17 17:50, James E. King, III via Boost wrote:
> That said, is there another macro that would allow me to change the code to
> do something like this?
> BOOST_ASSERT_ASSIGN_OR_IGNORE(std::codecvt_base::result r)
> & value, & value + 1, wend,
> m_buffer, m_buffer + sizeof(m_buffer), bend
> BOOST_ASSERT(std::codecvt_base::ok == r);
> where BOOST_ASSERT_ASSIGN_OR_IGNORE would expand to, assuming
> BOOST_ASSERT_ACTIVE is an indicator whether assert code is compiled in:
> #if BOOST_ASSERT_ACTIVE
> std::codecvt_base::result r =
> This would allow me to eliminate the warning without submitting a PR that
> changes the behavior of the code.
There is boost/core/ignore_unused.hpp that contains tools for
suppressing warnings about unused variables or types. For example, the
code above can be fixed by adding this line:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk