andorparens

use parentheses when mixing AND and OR

Prolint rule "andorparens" raises this warning when it finds a mix of OR and AND without parentheses.

A recent discussion at one of the PSDN forums showed that not everyone agrees what the correct execution precedence is of the logical operators, but still are confident enough to not use parentheses. As a result the program without parentheses may behave different than expected, which may lead to bugs. Using parentheses at least helps to make clear what the programmer's intentions are.

Example:

  EACH customer WHERE customer.salesrep=filterSalesrep OR filterSalesrep="*" AND customer.creditlimit>1000

can be interpreted in two different ways (if there is doubt about the correct precendece rules).
So to avoid confusion please rewrite to

  EACH customer WHERE (customer.salesrep=filterSalesrep OR filterSalesrep="*") AND customer.creditlimit>1000

or

  EACH customer WHERE customer.salesrep=filterSalesrep OR (filterSalesrep="*" AND customer.creditlimit>1000)