[previous] MISRA-C:2004  Rule  19.2:  (Advisory) [next] Non-standard characters should not occur in header file names in #include directives.
If the ', \, ", or /* characters are used between < and > delimiters or the ', \, or /* characters are used between the " delimiters in a header name preprocessing token, then the behaviour is undefined. Use of the \ character is permitted in filename paths without the need for a deviation if required by the host operating system of the development environment.

Example Code:


/* Permit nested C-style comments: */
/* PRQA S 3108 ++ */

/* PRQA S 0883 ++ */

#include "misra.h"
#include "m2cmex.h"

#if 0
/* No header files exist which correspond to
   the following #include directives.
   QAC will generate Hard Errors (Level 9)
   if this code block is not excluded      */

#include ".\abc.h"                      /* MISRA Violation */
#include "John's.h"                     /* MISRA Violation */
#include "Fred.h/*temporary*/"          /* MISRA Violation */
#include "Money$.h"                     /* MISRA Violation */
#endif

extern S16 test_1902( void )
{
   return 1;
}


QAC messages that encompass this guideline:

0813 [U] Using any of the characters ' " or /* in '#include <%s>' gives undefined behaviour.
0814 [U] Using the characters ' or /* in '#include "%s"' gives undefined behaviour.
0831 [E] Use of '\\' in this '#include' line is a PC extension - this usage is non-portable.


Related rules:

Rule  1.1 All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192
Rule  1.2 No reliance shall be placed on undefined or unspecified behaviour.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents