...
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 |
---|---|---|---|
CodeSonar | 4.4 | FB.CORRECTNESS.BSHIFT_WRONG_ADD_PRIORITY | Possible bad parsing of shift operation |
Bibliography
[ESA 2005] | Rule 65, Use parentheses to explicitly indicate the order of execution of numerical operators |
...