MISRA C:2012 Rule 8.1
Types shall be explicitly specified
Description
Rule Definition
Types shall be explicitly specified1 .
Rationale
In some circumstances, you can omit types from the C90 standard. In those cases, the
int
type is implicitly specified. However, the omission of an
explicit type can lead to confusion. For example, in the declaration extern
void foo (char c, const k);
, the type of k
is
const int
, but you might expect const
char
.
You might be using an implicit type in:
Object declarations
Parameter declarations
Member declarations
typedef
declarationsFunction return types
Polyspace Implementation
The rule checker flags situations where a function parameter or return type is not explicitly specified.
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: Declarations and Definitions |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2014b
See Also
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.