[previous] MISRA-C:2004  Rule  8.4:  (Required) [next] If objects or functions are declared more than once their types shall be compatible.
The definition of compatible types is lengthy and complex (ISO/IEC 9899:1990 [2], sections 6.1.2.6, 6.5.2, 6.5.3 and 6.5.4 give full details). Two identical types are compatible but two compatible types need not be identical. For example, the following pairs of types are compatible:

signed int             int
char [5]               char []
unsigned short int     unsigned short


QAC messages that encompass this guideline:

0626 [U] '%s' has different type to previous declaration (which is no longer in scope).
0627 [C] '%s' has different type to previous declaration in the same scope.
0628 [C] '%s' has different type to previous declaration at wider scope.
1510 '%1s' has external linkage and has incompatible declarations.


Related rules:

Rule  1.1 All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192
Rule  1.2 No reliance shall be placed on undefined or unspecified behaviour.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents