Re: [dev] [st PATCH] Simplify tputtab.

From: <noname_AT_inventati.org>
Date: Mon, 28 Apr 2014 21:42:16 +0400

On Mon, Apr 28, 2014 at 10:54:21AM +0200, Roberto E. Vargas Caballero wrote:
> > - for(++x; x < term.col && !term.tabs[x]; ++x)
> > + while(++x < term.col && !term.tabs[x])
> ...
> > - for(--x; x > 0 && !term.tabs[x]; --x)
> > + while(--x > 0 && !term.tabs[x])
>
> I'm sorry, but this patch is incorrect, because it is implementation defined
> when side effects of expressions are applied, so x of !term.tabs[x] can
> be x before decrement, or x after decrement.

&& 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).
...
"""
Received on Mon Apr 28 2014 - 19:42:16 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 28 2014 - 19:48:06 CEST