[Bf-committers] Re: Solution for suppressing "unused parameter" warnings?

Ed Halley ed at halley.cc
Sun May 28 01:20:22 CEST 2006

#define UNUSED(x)  { x = x; }

int foo(int a, char* b, float c[3])
	return 0;

This compiles cleanly in gcc from a quick test.  I dunno if gcc will 
*ignore* this usage but most others I've worked with over the years will 
just ignore the { x = x } construct completely, producing no bytecode 
but appeasing the warnings.  I have never found a compiler that wouldn't 
at least compile it cleanly without bad side effects.  It does not work 
with const arguments, however.

GSR wrote:
> Hi,
> sswaney at centurytel.net (2006-05-27 at 1355.49 -0400):
>>On Sat, May 27, 2006 at 07:26:51AM -0700, Ken Hughes wrote:
>>>I'm getting annoyed by all these warnings for "unused parameters", 
>>>mainly in the Python code.  
> [...] 
>>For reasons I can not quite put my finger on, setting  self = NULL;
>>strikes me somehow as lame.  It does, however, have the advantage of
>>working everyewhere.
> If that hack is used, I would do it via something else instead of NULL
> directly, so it is clear why people do such "lame" thing. Basically
> "#define UNUSED NULL" or "#define IGNORE 0" or whatever you choose but
> something that clearly says "hey, this is just filler, ignore it" and
> that can have the reasoning written in a comment above the #define
> line(s) (== comments that say why and how, thus avoiding silly
> questions, good comments).
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers

[ e d @ h a l l e y . c c ]

More information about the Bf-committers mailing list