25-04-2014, 01:47 PM
The MISRA C:2012 Rule Mappings document for rule 8.5 states:
MISRA-C:2004 rule 8.5 prevents definitions of objects and functions in a header file.
MISRA C:2012 permits definitions in header files, but has the following restrictions:
Quote:This rule has been deleted because some programming paradigms require the presence of executable code in a header file. It is also desirable for inline functions to appear in header files so as to avoid undefined issues. The problems associated with multiple declaration/definition of objects/functions are dealt with by other rules.
MISRA-C:2004 rule 8.5 prevents definitions of objects and functions in a header file.
MISRA C:2012 permits definitions in header files, but has the following restrictions:
- MISRA C:2012 rule 8.6 ensures that only one definition for an object or function can occur.
MISRA C:2012 rule 8.4 ensures that a compatible declaration is visible for external definitions in header files
MISRA C:2012 rule 8.10 requires that inline functions are declared with a static storage class so that undefined behaviour is avoided.
MISRA C:2012 directive 4.10 prevents multiple declarations or definitions in a translation unit.
Posted by and on behalf of the MISRA C Working Group