|
Boost : |
From: Rene Rivera (grafik.list_at_[hidden])
Date: 2003-10-31 00:33:13
Dear Boosters,
This little utility tries to solve the old problem of compiler warnings
about unused variables in the least impact way possible.
The solution I ended up implementing is different, hopefully better, than
the rest of solutions I saw currently in use in Boost:
* (void)variable;
// Does not working on all compilers.
* template<class T> inline void unused(const T &) {}
// Additional overhead of templates.
This implementation is a combination of macro and function:
namespace boost { namespace detail {
inline void no_unused_variable_warning(void*) { }
} }
#define BOOST_NO_UNUSED_VARIABLE_WARNING(v) \
::boost::detail::no_unused_variable_warning(&(v))
It has the benefits of clearly marking the intention, no template overheads,
and works on all compilers.
Please take a look at the archive for the files, documentation and test
included, at:
http://groups.yahoo.com/group/boost/files/disable_warning.zip
..and attached, as it's very small.
Enjoy.
-- grafik - Don't Assume Anything
-- rrivera (at) acm.org - grafik (at) redshift-software.com
-- 102708583 (at) icq
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk