What happens to this pointer to void?

This is the C code from the Make Controller firmware. I am familiar with void pointers, but I have never seen syntax like the first line of this function. What exactly is achieved by this?

void MakeStarterTask(void* parameters)
{
  (void)parameters;
  Run();
  TaskDelete(NULL);
}
+3
source share
3 answers

It “uses” parameters, so the compiler will not give a warning about an unused parameter, but the expression does nothing. Any expression can be added to void, which discards the result.

(Keep in mind that the expression is still evaluated to completely ignore the expression was more complex .)

+5
source

, unreferenced, UNREFERENCED_PARAMETER.

+1

Tells the compiler not to complain about an unused parameter parameters.

0
source

Source: https://habr.com/ru/post/1792416/


All Articles