[tz] logical and arithmetic ops and operator precedence.

Paul Eggert eggert at cs.ucla.edu
Sun Oct 27 23:06:53 UTC 2019


On 10/27/19 2:53 PM, Christos Zoulas wrote:

>                  if (lotm_ok & tm_ok
...
>                  if ((lotm_ok && tm_ok)

> for clarity? Both lotm_ok and tm_ok are booleans...

Plain AND is simple and goes pretty much all the way back to Boole, if not 
further. In contrast, short-circuit AND has dicey semantics and is a relative 
newcomer. Although it's awkward that C uses "&" for both plain and 
integer-bitwise AND, for booleans I mildly prefer "&" to "&&" when either will 
do, if only to remind readers of "&&"'s problems.


More information about the tz mailing list