On 12/19/2012 11:55 PM, Allin Cottrell wrote:
Hello all + season's greetings
Up till now gretl has supported only very limited usage of the
increment (++) and deccrement (--) operators. The only acceptable
usage has been in stand-alone expressions (e.g.)
j++ # shorthand for j = j + 1
j-- # shorthand for j = j - 1
for "j" the name of a user-defined scalar variable.
As of today's CVS I'm experimenting with fuller support for
something that is really quite handy in C and similar languages,
namely the ability to embed constructs such as "j++" and "j--" in
more or less arbitrary contexts. For example:
k = j++ # k = current value of j; then increment j
m[j++] = x # assign x to element j of m; increment j
x = foo(j--) # evaluate foo(j); decrement j
Hi Allin,
I guess it's hard to argue against new features, but for non-C people
like me I must say that the above example are a little
counter-intuitive. What I mean is the ordering of operations. For my
eyes the innermost operation would be the in-/decrementing that comes
first, then the function call / assignment.
So I'm not sure I like the C idioms taking over hansl...
Just my 2c,
Sven