Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-09-24 15:30:53


It's fairly common to have unused variables in Boost code for various
reasons. For instance, a common work around for a VC++ bug is to
have code such as:

template <typename T>
void foo(T* dummy=0)
{
}

The dummy parameter is never used, and is there solely to help the
VC++ compiler figure out the template argument types. Most compilers
will warn on such usage and as good citizens we should try and reduce
all possible warnings generated by any compiler. Currently I don't
see any mechanism for eliminating this stuff in the config files, but
Jeremy Siek has a simple solution in concept_check.hpp:

template <class T> inline void ignore_unused_variable_warning(const
T&) { }

I think it would be beneficial to have this in a more reusable
fashion for all Boost libraries and think the config files would be a
handy place for it (though I'd be fine with it in any other location
as long as it was a small header). I might reduce the name to just
unused_variable(), though other's might not care for the less verbose
name.

I currently have need of this for Boost.Threads, so... Any thoughts
or comments on this?

Bill Kempf


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