Boost logo

Boost :

From: brangdon_at_[hidden]
Date: 2001-09-24 16:14:10

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

Isn't it enough to omit the argument name?

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

Since the argument has no name it cannot be used, and I don't think any
compiler will warn about non-use. The name is just acting as a comment. If
you like, you can use a comment:

  template <typename T>
  void foo( T * /*dummy*/ = 0 )
Dave Harris

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