>
>
>
V2610. MISRA. The ', " or \ charac…


V2610. MISRA. The ', " or \ characters and the /* or // character sequences should not occur in a header file name.

This diagnostic rule is based on the MISRA (Motor Industry Software Reliability Association) manual for software development.

This rule only applies to C. If you use certain characters in header file names, this can lead to undefined behavior.

The rule prohibits using the following character sets:

  • ', ", \, /*, // — in the name of any included file specified between '<' and '>';
  • ', \, /*, // — in the name of any included file specified between double quotation marks.

Example:

#include <bad"include.h>
#include "bad'include.h"

More often the diagnostic reveals the presence of a backslash in the path. MISRA sees this code as incorrect:

#include "myLibrary\header.h"

However, you can use a forward slash:

#include "myLibrary/header.h"

This diagnostic is classified as:

  • MISRA-C-20.2