Unused parameter in c++11
Unused parameter in c++11 In c++03 and earlier to disable compiler warning about unused parameter I usually use such code: #define UNUSED(expr) do { (void)(expr); } while (0) For example int main(int argc, char *argv) { UNUSED(argc); UNUSED(argv); return 0; } But macros are not best practice for c++, so. Does any better solution appear with c++11 standard? I mean can I get rid of macros? Thanks for all! Sure. Turn off the warning. – Pete Becker Apr 2 '13 at 12:20 No! Do not do that! – Lightness Races in Orbit Apr 2 '13 at 12:22 How much better is that macro than expanding it inline? (void)argc; is shorter and clearer than UNUSED(argc); ...
