Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Question for Rule8.5
#2
The MISRA C:2012 Rule Mappings document for rule 8.5 states:
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.
MISRA C:2012 rule 8.5 is not relevant since it only refers to non-defining declarations.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)