Rule A16-2-1 (required, implementation, automated)

The ’, ", /*, //, \ characters shall not occur in a header file name or in #include directive.

Rationale

It is undefined behavior if the ’, ", /*, //, \ characters are used in #include directive, between < and > or “ ” delimiters.

Example

// $Id: A16-2-1.cpp 271687 2017-03-23 08:57:35Z piotr.tanski $

// #include <directory/headerfile.hpp> // Compliant
// #include <headerfile.hpp> // Compliant
// #include "directory/headerfile.hpp" // Compliant
// #include "headerfile.hpp" // Compliant
// #include <directory/*.hpp> // Non-compliant

// #include <header’file.hpp> // Non-compliant
// #include <"headerfile.hpp"> // Non-compliant
// #include <directory\\headerfile.hpp> // Non-compliant

See also

MISRA C++ 2008 [7]: Rule 16-2-4 The ’, ", /* or // characters shall not occur in a header file name. MISRA C++ 2008 [7]: Rule 16-2-5 The \character shall not occur in a header file name.