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:
> 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


and use it like this:


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

Regards, Daniel

Boost list run by bdawes at, gregod at, cpdaniel at, john at