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.
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