This rule is part of MISRA C++:2023.
Usage of this content is governed by Sonar’s terms and conditions. Redistribution is
prohibited.
Rule 19.2.3 - The ' or " or \ characters and the /* or // character sequences
shall not occur in a header file [1] name
[lex.header] Implementation 2
Category: Required
Analysis: Decidable,Single Translation Unit
Rationale
Use of the following are conditionally-supported with implementation-defined behaviour:
- The
' or " or \ characters, and the /* or // character sequences are used
between < and > delimiters in a header file [1] name preprocessing token;
- The
' or \ characters, or the /* or // character sequences are used between the
" delimiters in a header file [1] name preprocessing token.
Note: even on systems where \ is the path separator, most implementations will accept the / character as
an alternative.
Example
#include "file.h" // Compliant
#include "fi'le.h" // Non-compliant
#include "path\file" // Non-compliant
#include "path\\file" // Non-compliant
#include "path/file" // Compliant
Glossary
[1] Header file
A header file is considered to be any file that is included during preprocessing (for example via the #include directive),
regardless of its name or suffix.
Copyright The MISRA Consortium Limited © 2023