Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V3227. The precedence of the...
menu mobile close menu
Additional information
toggle menu Contents

V3227. The precedence of the arithmetic operator is higher than that of the shift operator. Consider using parentheses in the expression.

Sep 02 2025

The analyzer has detected a potential error: the expression can output a different result than expected because addition, subtraction, division, and multiplication operations have a higher precedence than shift operations.

The example:

private BigInteger OddPow (uint b, BigInteger exp)
{
  uint [] wkspace = new uint [mod.length << 1 + 1];
  ....
}

Most likely, it is expected that the shifting result of mod.length by 1 would add up to 1. However, according to the operator precedence, the addition occurs first, followed by the shift. To fix it, add parentheses.

The fixed code:

private BigInteger OddPow (uint b, BigInteger exp)
{
  uint [] wkspace = new uint [(mod.length << 1) + 1];
  ....
}

This diagnostic is classified as: