...
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 | ||||||
---|---|---|---|---|---|---|---|---|---|
Parasoft Jtest |
| CERT.EXP53.APAREN | Use '()' to separate complex expressions | ||||||
SonarQube |
| S864 |
Bibliography
[ESA 2005] | Rule 65, Use parentheses to explicitly indicate the order of execution of numerical operators |
...
...