MISRA Discussion Forums

Full Version: A Question for Rule8.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I have a question for the Rule8.5 etc.

The Rule8.5 in MISRAC_2004 was deleted in MISRAC_2012.

In MISRA C:2012 RuleMappings,
Rule8.5's description is
[The problems associated with --- dealt with by other rules].

I think that "other rules" means "Rule8.4, Rule8.5, and Rule8.6 in MISRAC 2012".

Is my opinion correct?

Please teach me your idea and rule numbers.

Best Regards,
Kumiko Itoh
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.