Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-24 07:10:33


Daniel Frey <daniel.frey_at_[hidden]> writes:

> David Abrahams wrote:
>> Rene Rivera <grafik.list_at_[hidden]> writes:
>>
>>>I was in the process of looking at some of the build warnings some of which
>>>are unused variable warnings. On Dave's suggestion I looked around for how
>>>this is solved in other places, and here's what I found.
>>>
>>>The following is defined/used in many places, in a variety of forms:
>>>
>>>template <class T> inline void unused_variable(const T&) { }
> >
>> Reasonable, though "no_unused_warning" might be more self-documenting.
>
> Although it plays better with namespaces, I wonder if a macro would
> make sense here:
>
> #define BOOST_NO_UNUSED_VARIABLE_WARNING( x ) (void)x
>
> Given that it works for all situations where needed

It doesn't. Some compilers warn :(

> , I see two (small) advantages:
>
> 1) Less overhead for the compiler, although it's probably already
> small enough compared to some other boost libraries

Is the macro expansion less expensive than just reading (void)x?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk