Using a "bald" function name is likely a bug. Rather than testing the return value of a function with a ``++void++`` parameter list, it implicitly retrieves the address of that function in memory. If that's truly what's intended, then it should be made explicit with the use of the ``++&++`` (address-of) operator. If it's not, then a parameter list (even an empty one) should be added after the function name.
if (func) { // Noncompliant - tests that the memory address of func() is non-null
//...
}
// ...
}
----
== Compliant Solution
----
void f2(int a, int b) {
// ...
if (func()) { // tests that the return value of func() > 0
//...
}
// ...
}
----
== Exceptions
Callback functions are a common occurrence and are usually not passed with a preceding &. There is however little ambiguity so this rule ignores function identifiers when used as a parameter of a function call.