This is just a weird oddity I came across. I can't think of a good reason
to use this code in a safe way, but here it is. (If anyone can think of a
legitimate case where you might risk range check errors, etc., I might
submit a bug report. Maybe there is another reason to use a function to
return an array index.)
// test routine
ARRAY TEXT(aText;4)
C_LONGINT($index)
$index:=0
aText{Index_Increment (->$index)}:="one"
aText{Index_Increment (->$index)}:="two"
aText{Index_Increment (->$index)}:="three"
aText{Index_Increment (->$index)}:="four"
// Index_Increment is:
C_POINTER($1)
C_LONGINT($0)
$1->:=$1->+1
$0:=$1->
In 4D v12, the test routine runs fine.
in 4D v16R5, the subroutine is called twice each time
Here's a quicker test for fun to see it in action:
ARRAY TEXT(aText;1)
aText{Num(Request("Enter 1"))}:="Bob's your uncle"
Jim
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************