A Question for Rule8.5

Moderators: misra-c, david ward

Post Reply
KumikoItoh
Posts: 6
Joined: Thu Feb 20, 2014 6:48 am
Company: HitachiAutomotiveSystems

A Question for Rule8.5

Post by KumikoItoh » Tue Apr 01, 2014 2:12 am

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

misra-c
Posts: 571
Joined: Thu Jan 05, 2006 1:11 pm

Re: A Question for Rule8.5

Post by misra-c » Fri Apr 25, 2014 2:47 pm

The MISRA C:2012 Rule Mappings document for rule 8.5 states:
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

Post Reply

Return to “8.8 Declarations and defnitions”