Wireshark-dev: Re: [Wireshark-dev] Unused variables
From: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx>
Date: Mon, 12 Feb 2007 15:06:03 +0100
I see. This works a little bit different than I expected.
  void method(int _U_)
  {
  }
just becomes
  void method(int )
  {
  }
I'm not sure if every compiler accepts that or also outputs a warning if the 
parameter name is missing.

I was searching for something like that:
  void method(int iParameter)
  {
    Q_UNUSED(iParemeter);
  }

This can be achieved by a compiler specific macro like this: (from qglobal.h)
/*
Avoid "unused parameter" warnings
*/
#if defined(Q_CC_INTEL) && !defined(Q_OS_WIN)
template <typename T>
inline void qUnused(T &x) { (void)x; }
#  define Q_UNUSED(x) qUnused(x);
#else
#  define Q_UNUSED(x) (void)x;
#endif

This way I don't need to change parameter names in the method signature which 
makes it easier to generate the code for me.

Is it possible to add such a macro to the wireshark framework?
e.g. G_UNUSED, WS_UNUSED or whatever fits into your naming convention.

regards,
Gerhard

On Monday 12 February 2007 14:29, Jeff Morriss wrote:
> Gerhard Gappmeier wrote:
> > Hi all,
> >
> > does wireshark have a macro to disable unused variable warnings
> > like Q_UNUSED in Qt?
>
> Wireshark has _U_ (when using a compiler where we're able to disable
> such warnings).
>
> _______________________________________________
> Wireshark-dev mailing list
> Wireshark-dev@xxxxxxxxxxxxx
> http://www.wireshark.org/mailman/listinfo/wireshark-dev