Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 20.2
#1
Why is
#include "c:\headers\measurement_regs.h "
non compliant to rule 20.2 due to \ in the path?
<t></t>
#2
It is undefined in the C Standard (Annex J.2) hence the MISRA rule:

Quote:The behavior is undefined in the following circumstances:
...
The characters ', \, ", //, or /* occur in the sequence between the < and >
delimiters, or the characters ', \, //, or /* occur in the sequence between the "
delimiters, in a header name preprocessing token (6.4.7).

Your example is even worse because you use a hard-coded drive letter.
Either use your compiler´s include path and change to or at least use relative paths with '/', e.g.
<t></t>
#3
The "\" is not permitted for the reasons mentioned by dg1980. A deviation is necessary, which will require you to confirm that "\" behaves as required on your system. Some implementations will accept the use of "/" instead of "\".
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)