CS.CONSTCOND.TERNARY

The condition of a conditional expression is always true or always false.

Example 1

Copy
  class IntSize {
      void GetIntSize() {
          return (sizeof(int) > 4 ? sizeof(int) : 4);  // defect - the condition is constant
      }
  }

Security training

Application security training materials provided by Secure Code Warrior.