Bill Allombert on Mon, 23 Sep 2002 16:42:10 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Is this specified ?


On Sun, Sep 22, 2002 at 05:45:42PM +0200, Thomas Baruchel wrote:
> Hi,
> 
> I noticed that
> 
>   until(a==(a+=b), ...
> 
> works (I want to increment a with b and stop when b is 0
> 
> BUT
> 
> may I consider this as something fully specified (ie. standard,
> portable, comprehensible, or whatever you want) or not ?

Avoid it. This is confusing, and will probably break GP2C with some
C compilers. Within GP, you stress the memory handler more than
what is neccessary.

until(a==(a+=b),SEQ) is equivalent to until(!b,SEQ;a+=b)

A remainder:
-- until evaluate the condition *after* the sequence.
-- You can use 'break' to go out of loop.
-- You can use a dummy if(1,SEQ1;SEQ2) to emulate the comma operator in C and
perl.

Cheers,

Bill.