...
Do not rely on implicit int
typing. Section 6.7.2 of the C Standard [ISO/IEC 9899:2011] states:
At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each
struct
declaration and type name.
...
Compliant Solution (Implicit Return Type)
This compliant solution explicily explicitly defines the return type of foo()
as unsigned int
.
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
GCC |
|
| Can detect violations of this rule when the | ||||||
Compass/ROSE |
|
|
| ||||||
| IF_MISS_DECL RETVOID.IMPLICIT |
| |||||||
| 24 D | Fully implemented. | |||||||
| decltype | Fully implemented. | |||||||
PRQA QA-C |
| 0434 (C) | Fully implemented. |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
ISO/IEC TR 24772 | "OTR Subprogram signature mismatch" |
---|---|
MISRA-C |
Bibliography
...
] | Section 6.7.2, "Type |
---|
...
Specifiers," and section 6.5.2.2, "Function |
---|
...
Calls" |
---|
ISO/IEC TR 24772 "OTR Subprogram signature mismatch"
Sources
...