CERT-EXP37-C_b
Synopsis
Call functions with the correct number and type of arguments.
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Do not call a function with the wrong number or type of arguments. Undefined behavior (UB) may arise as a result of invoking a function using a declaration that is incompatible with its definition or by supplying incorrect types or numbers of arguments. This check is identical to MISRAC2004-8.3.
This is a link analysis check.
Coding standards
- CERT EXP37-C
Call functions with the arguments intended by the API
- MISRA C:2004 8.3
(Required) For each function parameter, the type given in the declaration and definition shall be identical and the return types shall also be identical.
Code examples
The following code example fails the check and will give a warning:
/* Defect when used with example.pass.c */
void f();
void example(void) {
int x;
f(x);
}
The following code example passes the check and will not give a warning about this issue:
void f(long x) {}
void example(void) {
long x;
f(x);
}