Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2E2. If E1 has a signed type and a negative value, the resulting value is implementation defined and may be either an arithmetic (signed) shift, as depicted in Figure 5—2, :

Image Added

or a logical (unsigned) shift, as depicted in Figure 5—3

Image Removed

Figure 5—2. Arithmetic (signed) shift.:

This noncompliant code example fails to test whether the right operand is greater than or equal to the width of the promoted left operand, allowing undefined behavior.

...