We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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?
(void)b;
Also gives warning expression with possibly no effect.
void DoSomething(int a,int) { SomeOtherFunction(a); }
Thanks for that but it gives the same "non standard expression - unnamed parameter" warning as described above.
Oops - didn't see you had tried that. Stupid Keil compiler.
This is an old chestnut - it comes up again and again!
Some compilers are thoughtful enough to provide some kind of #pragma or similar to handle this.
Otherwise, it's a matter of finding some bening bit of code that doesn't then give some other warning - as you've found...
Have you tried
void DoSomething(int a, int b) { b=b; }
"benign"