Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V2610. MISRA. The ', " or \...
menu mobile close menu
Additional information
toggle menu Contents

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

Aug 30 2021

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-2012-20.2
  • MISRA-C-2023-20.2