[Gretl-devel] Re: Incrementing using the '++' operator

2019-06-23 Thread Allin Cottrell
On Mon, 17 Jun 2019, Allin Cottrell wrote: > On Sun, 16 Jun 2019, Artur Tarassow wrote: > > > I really like the C-style if-else syntax as well as the C-style '++' and > > '--' operators for incrementing and decrementing a number, respectively. But > > I am surprised to see that the following does

[Gretl-devel] Re: Incrementing using the '++' operator

2019-06-18 Thread Artur Tarassow
Am 17.06.19 um 23:29 schrieb Sven Schreiber: > Am 17.06.2019 um 18:14 schrieb Allin Cottrell: > > >> According to the C standard an operation such as >> >>    s = s++ >> >> leads to undefined behavior. In general, "s++" means, yield the current >> value of s then increment s, but with s itself on

[Gretl-devel] Re: Incrementing using the '++' operator

2019-06-18 Thread Sven Schreiber
Am 17.06.2019 um 18:14 schrieb Allin Cottrell: > According to the C standard an operation such as > >   s = s++ > > leads to undefined behavior. In general, "s++" means, yield the current > value of s then increment s, but with s itself on the left it's not > clear what has to be done. So, not

[Gretl-devel] Re: Incrementing using the '++' operator

2019-06-17 Thread Allin Cottrell
On Sun, 16 Jun 2019, Artur Tarassow wrote: > I really like the C-style if-else syntax as well as the C-style '++' and '--' > operators for incrementing and decrementing a number, respectively. But I am > surprised to see that the following does not work: > > > scalar s = 0 > loop i=1..2 -q >   

[Gretl-devel] Re: Incrementing using the '++' operator

2019-06-16 Thread Artur Tarassow
Am 16.06.19 um 16:52 schrieb Sven Schreiber: > Am 16.06.2019 um 16:03 schrieb Artur Tarassow: > >> >> scalar s = 0 >> loop i=1..2 -q >> catch s = (i==1) ? 1 : +1    # no effect >> s >> catch s = (i==1) ? 1 : s++    # no effect >> s >> catch s = (i==1) ? 1 : s+1    # works