In my current program I have a function already defined as
void functionName( const customClass object );
Now, in the code for this function, this object is not used. I don't have permission to to remove the parameter, nor can I remove the unused parameter warning.
Is there a statement I can execute with this object (customClass doesn't have any functions which I can run here), so that this warning doesn't happen?
You can remove the name of the parameter from the definition:
void functionName( const customClass );
This doesn't change the signature of the function (it's compatible with your existing declaration), but since the variable isn't named there won't be an unused parameter warning.
Common way to do this is
void functionName(const customClass object)
{
(void)object; // gets rid of warning
}
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