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

Line continuation characters '\' should not be followed by trailing whitespace

    Details

    • Type: Bug Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Message:
      Remove the whitespace after this "\" character
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      PPBackslashNotLastCharacter
    • Covered Languages:
      C, C++, Objective-C
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min

      Description

      The standard mentions that the line continuation character ({{}}) should be immediately followed by a newline or be the very last character of the file in order for the lines to be joined.

      Several compilers relax this requirement by allowing whitespace after the {{}} character, but this is not portable because other compilers may not do the same.

      Compliant Solution

      // There should be no whitespace after the '\'
      #define FOO BAR \
                  BAZ
      

        Attachments

          Issue Links

          1.
          C-Family RSPEC-4382 Language-Specification Active Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ann.campbell.2 Ann Campbell
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: