Well, so then you're exposed to this error. Do:
void foo(int x)
{
(void)x;
}
to silence unused parameter warnings.Well, so then you're exposed to this error. Do:
void foo(int x)
{
(void)x;
}
to silence unused parameter warnings.Very little C code is const-correct either. Most of the C devs I know make fun of const-correctness.
It's only an eyesore if you don't acknowledge the benefits that strict warnings can bring to the table.
| Most of the C devs I know make fun of const-correctness.
I for one don't mind putting in a tiny bit of upfront effort so that my compiler can double-check my work. Do the C devs you know also make fun of assert?
And, no. Nobody makes fun of assert. Which rather makes my point for me.
I'm not as dogmatic as some others are in the thread. I just think it's a good idea to be warned when a variable is unused, enough that I'll mark my very few that might be #ifdef'ed out. If you're using a compiler that doesn't let you mark variables as such... well that sucks. You do what you can.
int foobar(int foo, int bar __attribute__((unused))) { /* Code that does not use bar */}