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

S1705: FP when the returned value is actually used

    XMLWordPrintable

    Details

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

      Description

      In code such as the following, when the return value not discarded, avoiding the use of postfix increment leads to code even harder to understand:

      const int someValue = iter != vec.end() ? *iter++ : 0;
      

        Attachments

          Activity

            People

            Assignee:
            loic.joly Loïc Joly
            Reporter:
            loic.joly Loïc Joly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: