multiple assignment to array
issueid=349 17-03-2012 11:54
zak zak is offline
Senior Member
Number of reported issues by zak: 12
multiple assignment to array
freezing or not depends on specifyng array type

Hi Eros
in this recent thread while reading Petr answer
i have tried this example :
Uses "console"
Dim a(10) As Long
a(4)=2,4,6,8,5,6,3,2
PrintL a(1)
PrintL a(4)
PrintL a(5)
WaitKey
this will output 0, 2, 4 as expected, without freezing.
but suppose i forgot to specify long type in dim a(10)
the program print the correct answer but hange
and the hanging are only from a(4), a(5), and up.
but it does not hang when we write
a(1)=2,4,6,8,5,6,3,2
or a(2)=2,4,6,8,5,6,3,2
or a(3)=2,4,6,8,5,6,3,2
if we reduce the items like
a(4)=2,4,6,8,5 it will not hang
Issue Details
Issue Number 349
Project thinBasic
Category Unknown
Status Unconfirmed
Priority Unknown
Affected Version 1.8.9
Fixed Version (none)
Milestone (none)
Users able to reproduce bug 1
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)




17-03-2012 19:12
Super Moderator
Hi Zak,

thanks a lot for reporting this issue!
It is odd it does not fail for LONGs as well
Uses "console"
Dim a(10) As Long
a(4)=2, ' -- assigns to a(4)
     4, ' -- assigns to a(5)
     6, ' -- assigns to a(6)
     8, ' -- assigns to a(7)
     5, ' -- assigns to a(8)
     6, ' -- assigns to a(9)
     3, ' -- assigns to a(10)
     2  ' -- assigns to a(11) -> that is not defined!
     
PrintL Join$(a, ",")     

WaitKey
I think in this case the error 400: Subscript out of range in array or matrix should be fired, to avoid confusion


Petr

P.S. What does it mean when you do this?:
dim a(10)
... it does not mean forgotten type, but in fact it is equivalent to:
dim a(10) as variant
For reason unknown, the variants were more sensitive for the improper assignment above, but at least it helped us find the issue! :)

+ Reply