A co-worker wrote a function like this (the comment was written by me):
static void foo(void *arg)
{
    //arg is NOT global variable
    arg = arg;
    // call other function, but doesn't use arg
    foo2();
}
Is there some reason to write code like this? Does it have some special purpose?
This is just one way of suppressing a compiler warning for an unused argument.
Other common methods are:
(void)arg;
or
#pragma unused (arg)    // not supported by all compilers
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With