From f02778f83c9a1dfaae895a52d3a49417a8f340ea Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 20 Jan 2010 17:17:45 +0000 Subject: 27611: cache parameter values in math eval so subscripts are eval'd once --- Test/C01arith.ztst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Test/C01arith.ztst') diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst index 02612bd79..1f0d2d0f3 100644 --- a/Test/C01arith.ztst +++ b/Test/C01arith.ztst @@ -188,3 +188,25 @@ >0xFF >FF + array=(1) + x=0 + (( array[++x]++ )) + print $x + print $#array + print $array +0:no double increment for subscript +>1 +>1 +>2 + + # This is a bit naughty... the value of array + # isn't well defined since there's no sequence point + # between the increments of x, however we just want + # to be sure that in this case, unlike the above, + # x does get incremented twice. + x=0 + array=(1 2) + (( array[++x] = array[++x] + 1 )) + print $x +0:double increment for repeated expression +>2 -- cgit 1.4.1