4 ms·
>There are dozens of perfectly valid reasons why a parameter would go unused, so the occasional error just gets lost in the noise. Such as?
by torpor 16y ago
>There are dozens of perfectly valid reasons why a parameter would go unused, so the occasional error just gets lost in the noise.
Such as?
- kelnos 16y agoI can only think of a few, but they're valid: 1. An API-defined callback signature where you need to use (for example) the first and third parameters, and not the second. 2. A public API function that has become deprecated and the previous behavior is emulated in a way that doesn't require all the parameters. 3. Stub/wrapper functions. 4. Init/cleanup functions for modules written to a plugin API, when all parameters passed are not needed in all cases. 5. Language binding closure/thunk functions. Most of the uses, I think, boil down to backwards compat and fixed callback/plugin interfaces. In those cases I think an __attribute__((unused)) or void cast aren't a huge burden. I usually turn on -Wunused-parameter just in case.