[previous] MISRA C:2012  Rule-20.2:  (Required) [next] The ', " or \ characters and the /* or // character sequences shall not occur in a header file name

Example Code:


#include "misra.h"
#include "m3cmex.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 <John's.h>                     /* Non-compliant * 0813 0818 */
#include <Fred.h/*temporary*/>          /* Non-compliant * 0813 0818 */

#include "John's.h"                     /* Non-compliant * 0814 0818 */
#include "Fred.h/*temporary*/"          /* Non-compliant * 0814 0818 */

#include ".\abc.h"                      /* Non-compliant * 0831 0818 */

#endif


extern int16_t rule_2002( 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.2 Language extensions should not be used
Rule-1.3 There shall be no occurrence of undefined or critical unspecified behaviour



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