Mail Archives: djgpp/1997/10/11/19:55:14
At 09:58 10/11/1997 +0300, Roman Suzi wrote:
>Hi, all!
>
>I have an annoying problem with C and C++ (DJGPP).
>
>The question is: how to control 'unused argument/variable'
>warning so, that I will receive a warning only
>when it is really wanted?
>(The problem is not just that of switching
>all warnings manually and leaving unswitched
>a few of them)
>
>In some functions I have comletely justified unused variables:
>they are just pointing the type of template, or
>they are elements in arrays of functions, but
>some parameters are unused.
>But sometimes the warning become warning: I dont want
>just switch the flag off.
>
>
>
>What can I add to suppress them in GCC, so that
> - I shall not receive another kind of warning;
> - the effectiveness of the code will remain the
>same (no additional commands will be inserted for dummy
>usage of the variables) ?
So you want to suppress the warning just in certain places? If you want to
suppress completely, use -Wno-unused. Otherwise, you can place something like:
int unused_variable;
(void)unused_variable;
The compiler is smart enough not to generate any code for it. Look at the
assembly and see!
Nate Eldredge
eldredge AT ap DOT net
- Raw text -