Upss, you are rigth.
> && is a sequence point
>
> According to ISO IEC 9899:1999:
> """
> The following are the sequence points described in 5.1.2.3:
> ...
> - The end of the first operand of the following operators: logical AND
> && (6.5.13); logical OR || (6.5.14); conditional ? (6.5.15); comma , (6.5.17).
According to point 5.1.2.3:
Accessing a volatile object, modifying a file, or calling
a function that does any of these operations are all side
effects, which are changes in the state of the execution
environment. Evaluation of an expression may produce side
effects. At certain specified points in the sequence
called sequence points, all side effects of previous
evaluations shall be complete and no side effects of
subsequent evaluations shall have taken place.
But I feel that the patch is a bit confusing. I use sometime this kind
of expressions (for example (!(p = f()) || p != q), and I get confussed
here, so maybe it is not a good idea. If another suckless developers think
the patch should be applied then I will apply it.
Regards,
--
Roberto E. Vargas Caballero
Received on Mon Apr 28 2014 - 20:40:34 CEST