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

Proposed rule: conditions should not be trivially redundant

    XMLWordPrintable

    Details

      Description

      Report cases of redundant conditions (condition subexpressions that are trivially true or false). Examples:

      unsigned a = ...;
      unsigned b = ...;
      unsigned c = ...;
      if (a < 10 && a < 100) ...
      if (10 < a || 100 < a) ... // first inequality is redundant
      if (a < 10 && true) ...
      if (a < b && b < c && a < c) ... // last inequality is redundant
      

      Generalizes S1125

        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: