Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity
    • Default Quality Profiles:
      Sonar way, MISRA C++ 2008 recommended

      Description

      Noncompliant Code Example

      if ( a == a ) { // always true
        do_z();
      }
      if ( a != a ) { // always false
        do_y();
      }
      if ( a == b && a == b ) { // if the first one is true, the second one is too
        do_x();
      }
      if (a == b || a == b ) { // if the first one is true, the second one is too
        do_w();
      }
      
      if (5 / 5) { // always 1
        do_v();
      }
      if (5 - 5) { // always 0
        do_u();
      }
      

      Exceptions

      The following are ignored:

      • The expression 1 << 1
      • When an increment or decrement operator is used, ex: *p++ == *p++
      • Bitwise operators |, &, ^

        Attachments

          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: