MISRA C++:2008 Rule 16-2-5
The \ character should not occur in a header file name
Description
Rule Definition
The \ character should 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 character
\between the delimiters < and
> or between the delimiters " is undefined behavior.
Using / in a header file name might result in unexpected behavior.
Some environments use the character \ as a file name delimiter, for
instance, when describing paths. Compilers for these environments might support the use of
\ in an #include directive.
Polyspace Implementation
Polyspace® raises a violation of this rule if the character \ occurs
in a header file name.
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: Advisory |
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.