32 lines
631 B
Plaintext
32 lines
631 B
Plaintext
== Why is this an issue?
|
|
|
|
Unused function parameters are often due to design changes and can lead to mismatched parameter lists.
|
|
|
|
|
|
Exception: An unnamed parameter in the definition of a function that is used as a callback does not violate this rule.
|
|
|
|
|
|
Example:
|
|
|
|
|
|
----
|
|
typedef int (*CallbackFn)(int a, int b);
|
|
|
|
int Callback_1(int a, int b) // Compliant - "a" and "b" both used
|
|
{
|
|
return a + b;
|
|
}
|
|
|
|
int Callback_2(int a, int b) // Non-Compliant - "b" is unused
|
|
{
|
|
return a;
|
|
}
|
|
|
|
int Callback_3(int a, int) // Compliant - unnamed callback parameter exception
|
|
{
|
|
return a;
|
|
}
|
|
----
|
|
|
|
|