MISRA Discussion Forums
A Question for Rule8.5 - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21)
+---- Forum: 8.8 Declarations and defnitions (https://forum.misra.org.uk/forumdisplay.php?fid=163)
+---- Thread: A Question for Rule8.5 (/showthread.php?tid=1044)



A Question for Rule8.5 - KumikoItoh - 01-04-2014

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


Re: A Question for Rule8.5 - misra-c - 25-04-2014

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.