MISRA C:2012 Rule 17.3
A function shall not be declared implicitly
Description
Rule Definition
A function shall not be declared implicitly.
Rationale
An implicit declaration occurs when you call a function before
declaring or defining it. When you declare a function explicitly before
calling it, the compiler can match the argument and return types with
the parameter types in the declaration. If an implicit declaration
occurs, the compiler makes assumptions about the argument and return
types. For instance, it assumes a return type of int
.
The assumptions might not agree with what you expect and cause undesired
type conversions.
Additional Message in Report
Function 'XX' has no complete visible prototype at call.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Function |
Category: Mandatory |
AGC Category: Mandatory |
Version History
Introduced in R2014b