Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dir 4.10: Is a different form of the include guard considered a violation of the directive?
#2
#if (!defined identifier) does not violate directive 4.10.

Dir 4.10 is a directive which means a full description is not provided ( see Section 6.1) Static analysis tools may assist in checking compliance of directives, but different tools may place different interpretations on what constitutes a non-compliance.

The purpose of the Directive is to prevent multiple inclusion of an Include file, and while the examples provided are informative only, any other form of Include Guard is compliant.

However, it is accepted that the two forms shown as examples that are most commonly checked by static analysis tools. Therefore the user is encouraged to use those forms where possible.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)