Main Content

MISRA C:2023 Rule 20.2

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

Since R2024a

Description

Rule Definition

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

Rationale

The program's behavior is undefined if:

  • You use ', ", \, /* or // between < > delimiters in a header name preprocessing token.

  • You use ', \, /* or // between " delimiters in a header name preprocessing token.

Although \ results in undefined behavior, many implementations accept / in its place.

Polyspace Implementation

Polyspace® flags the characters ', ", \, /* or // between < and > in #include <filename>.

Polyspace flags the characters ', \, /* or // between " and " in #include "filename".

Troubleshooting

If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Preprocessing Directives
Category: Required
AGC Category: Required

Version History

Introduced in R2024a