Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-1802

S935: Exclude void expressions from returns with values

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: Rules
    • Labels:
      None

      Description

      It is not uncommon in C & C++ to explicitly return a void value as a way to group statements:

      void foo() { ... }
      void bar() {
        // ...
        if (cond)
           return foo();
        // ...
      }
      

      This shouldn't raise an issue
      FP example

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              massimo.paladin Massimo PALADIN
              Reporter:
              jeanchristophe.collet Jean-Christophe Collet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: