0

The below funtion already has the variable declaration as uint8_t. But still why inside the function we need to declare it in different way?

bool cli_cdc_enable(uint8_t port)
{
    (void) port;

    cdc_connected = true;
    return true;
}
user3386109
  • 32,020
  • 7
  • 41
  • 62
  • You don't need to redeclare it. with the parentheses around void, you're actually casting it to void then not using it. Does that even compile? – Jonathan Olson Aug 24 '17 at 04:03
  • This is done to suppress any compiler warning(s) which complains that the variable `port` is unused. – CinCout Aug 24 '17 at 04:05

1 Answers1

0

There's no need. This kind of thing is usually to indicate to compiler warnings and lint tools that the variable is deliberately unused. It doesn't have any effect on what the function does.

user2357112 supports Monica
  • 215,440
  • 22
  • 321
  • 400