LARGE For loop bug found!

BlitzMax Forums/BlitzMax Programming/LARGE For loop bug found!

Grey Alien(Posted 2007) [#1]
[EDIT] FORGET IT! I forgot to call NEW TCollideObject on each one, sorry to waste your time (I'll get my coat). I was running with debug mode turned off and it didn't complain about the null objects.

Check it out:

Strict

Type TCollideObject
	Field Value%
End Type

Global CollideObjects:TCollideObject[10]

Global Ints[10]

For Local i=0 To 9
	CollideObjects[i].Value=i
	Ints[i]=i
	Print "i="+i
Next

For Local i=0 To 9
	Print "objects="+CollideObjects[i].Value
	Print "ints   ="+ints[i]
Next


The results should be self explanatory, but basically when i is assigned to the object Value field it is always 9! The max value from the loop. Yet when assigned to the int array (and when printed) it's correct.

This has gotta be a bug right? If you agree I'll post it in the bug forum.

Done in BMax 1.24 fully synced.


MGE(Posted 2007) [#2]
You must be knee deep in a project. ;) I get like that too (kind of frantic) when something weird happens that can potentially run your code into a brick wall. ;)


Grey Alien(Posted 2007) [#3]
It got me weirded out for about 30 mins before I posted, then I fixed it :-)