1

i was working on Iotivity framework, while tracing i was not able to know the use of these statements. iotivity-1.3.0/resource/csdk/stack/src/ocstack.c

i'm curious to know the usage...

OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode)
{
(void) ipAddr;
(void) port;
return OCInit1(mode, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS);
}
Sourav Ghosh
  • 127,934
  • 16
  • 167
  • 234
Bharath T S
  • 551
  • 5
  • 5

1 Answers1

2

In the code

(void) ipAddr;
(void) port;

is a way to silence compiler warning about "unused" variables.

It comes handy when the APIs has to follow a certain pattern to accept a number of parameters to conform to some standard, but actually, in the code you do not use the variables anyway.

Sourav Ghosh
  • 127,934
  • 16
  • 167
  • 234
  • In this case, a look at the documentation should clarify, there were once used but no longer: `ipAddr IP Address of host device. Deprecated parameter. ` `port Port of host device. Deprecated parameter.` – Mats Wichmann Aug 02 '17 at 12:33