MISRA C++:2008 Rule 16-2-4
The ', ", /* or // characters shall not occur in a header file name
Description
Rule Definition
The ', ", /* or // characters shall not occur in a header file name.1
Rationale
You include header files in a source file by enclosing its name between the delimiters
          <> or "". Using the characters
          ', ", /*, or
          // between the delimiters < and
          > is undefined behavior. Using the characters ',
          /*, or // between the "
        delimiters also results in undefined behavior. Depending on your environment and compiler,
        using these characters in a header filer name might result in unexpected behavior.
Avoid the characters ', ", /*,
        or // in a header file name.
Polyspace Implementation
Polyspace® raises a violation of this rule if the name of a header file includes one of these characters:
- '
- "
- /*
- //
If you use the character " between the delimiter
          ", Polyspace interprets the portion of the header name between two successive
          " delimiters as the header file name. For instance, in this
          code,
#include "foo\".h"
foo\ as the header name. In such cases,
          Polyspace does not raise a violation of this rule, but because the compiler looks for a
        header file that does not exist, you might get a compilation warning.Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Preprocessing Directives | 
| Category: Required | 
Version History
Introduced in R2013b
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
- MISRA C:2004 
- MISRA C:2012 
- MISRA C:2023 
- MISRA C++:2008 
- MISRA C++:2023 
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.