Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added "automated detection" section

...

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

Bibliography

[ESA 2005]

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

[Tutorials 2013]

Expressions, Statements, and Blocks

...