ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Unused variables

From: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx>
Date: Mon, 12 Feb 2007 18:23:24 +0100

So
#define REFERENCE_PARAMETER(name) (void)name;
works good for me.
void method(int foo)
{
  REFERENCE_PARAMETER(foo);
}

The intel compiler is a little bit different, that's why trolltech  
uses
this kind of define.

#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
    
Isn't it C++? Wireshark uses only C.
  
Qt is C++. Also the inline keyword may be problematically with some compilers.
But the Q_UNUSED macro also works with C.
Template and inline is only used with  Intel compiler which is a C++ compiler.
The #else part for windows and GCC is pure C.

Are there any reasons to not use such a kind of macro?