2 ms·
"Still, -Wunused is helpful to find errors elsewhere in the code, so in these cases you might do something like unused_param = unused_param;" It is better to c
by Someone 12y ago
"Still, -Wunused is helpful to find errors elsewhere in the code, so in these cases you might do something like
unused_param = unused_param;"
It is better to comment out the name of the argument in the function header:
void foo( int x, int /* unused */)
{
…
}
C compilers know not to complain about that second argument (http://stackoverflow.com/questions/1486904/how-do-i-best-silence-a-warning-about-unused-variables http://stackoverflow.com/questions/1486904/how-do-i-best-sil...)
- hkl 12y agoThat's C++, not C. In C, the parameter name must be specified in a definition. I tried with 7 compilers, and none of them allow it as an extension, either, as they all consider it a fatal error.