Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-975

The '\' character should not occur in a header file name

    Details

    • Type: Finding Detection
    • Status: Closed
    • Resolution: Fixed
    • Labels:
      None
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Legacy Key:
      PPIncludeBackslash
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min

      Description

      It is undefined behavior 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. However, compilers for those environments often support the use of '/' in #include directives.

      Noncompliant Code Example

      #include "foo\bar.h" /* Noncompliant */
      

      Compliant Solution

      #include "foo/bar.h" /* Compliant */
      

      See

      • MISRA C++:2008, 16-2-5 - The \ character should not occur in a header file name.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Anonymous
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: