Not to be nitpicking about modern C++, but the attributes are the official way to declare a variable as unused
static int _board_handler(__attribute__((unused)) int argc,
__attribute__((unused)) char **argv)
{
puts(RIOT_BOARD);
return 0;
}
It makes the programmer’s intention much more explicit than (void)
, and thus should be strongly encouraged.
The (void) thing
trick was a workaround, before C++11 officially introduced __attribute__
annotations.
It is not (yet) part of the C standard, but is supported by the GNU gcc compiler as an extension (ie. works with gcc, but maybe not with other compilers).
Actually, there could be an “maybe_unused” keyword in the next C standard see 6.7.11.3 in
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2454.pdf