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

Proposed rule: return value of a function should be used

    XMLWordPrintable

    Details

      Description

      A stronger version of S5277: if a function return value was assigned to a variable, that variable must be used later on.
      Detect whether the return value reaches some "sink" - assigned to a member, global, or static variable; returned from a function, stored to a reference or pointer, affected the control flow.

      Do not report cases of a function return value ignored from the beginning (e.g., set.insert( x );. Report cases when the value is assigned to a variable, and that variable then has no effect on the further execution.

      Also, see S6007 as another heuristic for a function which value should not be discarded.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              arseniy.zaostrovnykh Arseniy Zaostrovnykh
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: