Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor grammar changes

...

The bitwise AND and OR operators (& and |) do not exhibit this lack short-circuit behavior. Similar to most Java operators, they evaluate both operands. They return the same Boolean result as && and || respectively but can have different overall effects depending on the presence or absence of side effects in the second operand.

...

This noncompliant code example, derived from Flanagan [Flanagan 2005], has two variables, with no without guarantees regarding their current values. The code must validate its data and then check whether array[i] is a valid index.

...

This noncompliant code example demonstrates code that compares two arrays for ranges of members that match. Here i1 and i2 are valid array indices in array1 and array2 respectively. Variables end1 and end2 are expected to point to the end the indices of the ends of the matching ranges in the two arrays.

...

The problem with this code is that when the first condition in the while loop fails, the second condition is does not executedexecute. That is, once i1 has reached array1.length, the loop terminates after i1 is incremented. Consequently, the apparent range over array1 is larger than the apparent range over array2, causing the final assertion to fail.

...