On Mar 24, 2014, at 4:20 PM, mathog wrote:
torev = torev
trick is one way to silence the "unused argument" warning in gcc and last time I checked it worked for several other compilers as well, like Sun's compiler. Apparently not for clang though. Note this is in a C module, so the C++ syntax to indicate an unused argument will not work. AFAIK the C language specification provides no standard way to eliminate this warning or its evil twin "statement with no effect", which is what you get if you try to finesse this situation with:
(void) torev;
Quite interesting... my experience has been some of the opposite.
That is, the self assignment usually would only work for MSVC and not gcc. But perhaps that is combined with C vs C++ mode/flags on the compiler.
Using the void cast would usually be preferable, and was happy on many systems including compilers for Netware. :-)
For C++, of course, we can just leave the name off the parameter. But as you mention, these files should be C so we can't do that there. I think the main alternatives are to use some compiler specific decorations on the params with macro magic, or an UNUSED_PARAM() or REF_PARAM() macro that can do the 'correct' thing in most cases and then maybe have one or two edge case variants.