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

Ken Hughes khughes at pacific.edu
Sun May 28 18:41:38 CEST 2006


Jean-Luc Peurière wrote:
> 
> Le 28 mai 06 à 01:20, Ed Halley a écrit :
> 
>>
>> #define UNUSED(x)  { x = x; }
>>
>> int foo(int a, char* b, float c[3])
>> {
>>     UNUSED(a);
>>     UNUSED(b);
>>     UNUSED(c[0])
>>     return 0;
>> }
> 
> 
> not good from an optimisation point of view.

I agree that using the unused args just to shut up the compiler isn't a 
great idea, especially if the compiler is smart enough to know that the 
use does nothing and just created another warning.

> you can either use the unused attribute (but that may not be supported
> by all compilers), or pass the following compiling option to gcc :
> 
> -Wno-unused-parameter

That's the issue; is there a way we can shut it up for everybody, not 
just gcc users?  Is the __attribute__ keyword supported by MS and MacOS 
  compilers?

Ken


More information about the Bf-committers mailing list