[Bf-committers] unused function args & warnings.

Michael Matthews erobererunc at gmail.com
Wed Oct 13 07:57:19 CEST 2010

I personally think this is a good idea.  One thing to note, Qt has a macro
that is used in the body of the function, which may be cleaner than the one
in the parameter list.  Here's the definition (from qglobal.h)

#if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT)
template <typename T>
inline void qUnused(T &x) { (void)x; }
#  define Q_UNUSED(x) qUnused(x);
#  define Q_UNUSED(x) (void)x;

On Tue, Oct 12, 2010 at 11:16 PM, Campbell Barton <ideasman42 at gmail.com>wrote:

> Id like to enable warnings in GCC for unused args, however this gives
> a lot of warnings for functions which have args which are needed so
> the function can be used as a callback.
> This would only apply to C code in blender's source/ and intern/ dirs,
> since it doesn't make sense to modify external libs for this.
> We could have a #define for UNUSED() as described here.
> http://sourcefrog.net/weblog/software/languages/C/unused.html
> this way a function will have UNUSED added like this...
> void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void
> *UNUSED(dummy))
> While its a ugly to have UNUSED() in with the function args also makes
> it clear that its intentionally unused and makes sure when arguments
> become unused that a developer can see why and possibly remove it.
> Writing to the list because this would end up changing many files in
> blender which I don't maintain.
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

More information about the Bf-committers mailing list