Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

MISRA.INCL.SYMS

Non-standard characters in header file names.

MISRA C 2012 Rule 20.2: The ', " or \ characters and the /* or // character sequences shall not occur in a header file name

C90 [Undefined 14], C99 [Undefined 31]

Category: Required

Analysis: Decidable, Single Translation Unit

Applies to: C90, C99

Rationale

The behaviour is undefined if:
  • The ', " or \ characters, or the /* or // character sequences are used between < and > delimiters in a header name preprocessing token;
  • The ' or \ characters, or the /* or // character sequences are used between the " delimiters in a header name preprocessing token.
Note: although use of the \ character results in undefined behaviour, many implementations will accept the / character in its place.

Example

#include "fi'le.h" /* Non-compliant */

MISRA-C 2004 Rule 19.2 (advisory): Non-standard characters should not occur in header file names in #include directives.

Non-standard characters in header file names.

[Undefined 14]

If the ', \, ", or /* characters are used between < and > delimiters or the ', \, or /* characters are used between the " delimiters in a header name preprocessing token, then the behaviour is undefined. Use of the \ character is permitted in filename paths without the need for a deviation if required by the host operating system of the development environment.

MISRA-C++ 2008 Rule 16-2-4 (required): The ', ", /* or // characters shall not occur in a header file name.

[Undefined 2.8(2)]

Rationale

It is undefined behaviour if the ', ", /* or // characters are used between < and > delimiters or the ', /* or // characters are used between the " delimiters in a header name preprocessing token.

Example

#include "fi'le.h" // Non-compliant

MISRA-C++ Rule 16-2-5 (advisory): The \ character should not occur in a header file name.

[Undefined 2.8(2)]

Rationale

It is undefined behaviour if the \ character is used between < and > delimiters or between the " delimiters in a header name preprocessing token.

Note that this rule is only advisory, since some environments use \ as a file name delimiter. Compilers for these environments often support the use of / in #include directives.

Example

#include "fi\\le.h" // Non-compliant