Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"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-sil...)


That'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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: