Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2007-07-28 03:47:00


Michael Marcin wrote:
> A long time ago I read a post that mentioned a standard way to disable
> unused variable warnings in boost. Specifically this one:
>
> http://tinyurl.com/2o4ovh
>
> Although a trivial utility it seems generally useful to me and I was
> wondering if it existed in boost as a utility somewhere.
>
> It seems silly to recreate that function every time you need to disable
> such a warning.

Dave suggests two possibilities - and I prefer the second, plus a comment:

void f( int /*unused*/ )

Which does not instantiate a template and is a clear and documented way
to show that you really meant to have a parameter which is not used. As
a third option, we could add

#define BOOST_UNUSED_PARAMETER

and use it like this:

void f( int BOOST_UNUSED_PARAMETER )

just in case you want to avoid block-comments in your code.

Regards, Daniel


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