Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft Jtest 2022.2

...

Although it advises against depending on parentheses for specifying evaluation order , EXP05-J. Do not write more than once to the same variable follow a write by a subsequent write or read of the same object within an expression applies only to expressions that contain side effects.

...

Detection of all expressions using low-precedence operators without parentheses is straightforward. Determining the correctness of such uses is infeasible in the general case, although heuristic warnings could be useful.

Automated Detection

Tool
Version
Checker
Description
CodeSonar4.4FB.CORRECTNESS.BSHIFT_WRONG_ADD_PRIORITYPossible bad parsing of shift operation
Parasoft Jtest
Include Page
Parasoft_V
Parasoft_V
CERT.EXP53.APARENUse '()' to separate complex expressions
SonarQube
Include Page
SonarQube_V
SonarQube_V
S864

Bibliography

[ESA 2005]

Rule 65, Use parentheses to explicitly indicate the order of execution of numerical operators

[Tutorials 2013]

Expressions, Statements, and Blocks

...


...

Image Modified Image Modified Image Modified