In the function:
void DoSomething(int a, int b) {
SomeOtherFunction(a); }
The compiler (C166) generates the warning unused parameter b. So I tried:
b;
And get warning expression with possibly no effect. So I tried:
void DoSomething(int a, int /*b*/) {
And got warning non standard extension - unnamed parameter!
Anybody got any other ideas?
per c166 docs:
#pragma warning disable = 47
http://www.keil.com/support/man/docs/c166/c166_warning.htm
Doesn't seem to be an option to "restore previous setting", though?
Wow, I didn't expect so many helpful replies. Thanks for all the good advice. I also tried the if(b); option but it gives an expression has no effect warning. So, the conclusion seems to be that disabling the warning is the only option.
If it did work I would definitely think an unused() macro would be the way to go.
I don't really like to remove the warning as it has saved me before from doing something done and is good for pointing out potential design issues in your code. I guess I can live with it for now fortunately they are in modules that are rarely recompiled.
Thanks for all the advice...
I don't really like to remove the warning as it has saved me before from doing something
I have to agree here. There should be a possibility to mark a singular parameter. I definitely want a warning like this in general. But I want to turn it off if I keep a parameter to conform with a certain interface.
Lints /* ARGSUSEDn */ comes to mind.