Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Beta Versions
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Beta Versions This forum is the place to discuss issues regarding Basic4ppc beta versions.

Array keyword compiler problem

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-28-2008, 03:08 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default Array keyword compiler problem

I've been having trouble with a program that sometimes optimised compiles and some times doesn't
Code:
Sub Globals
    
Dim a(0
End Sub

Sub App_Start    
End Sub

Sub AlSort
    a() = 
Array ( "a""x""G",  "c""X""A""g""C""u""U" )
End Sub

Sub AlToArray
End Sub

Sub Rank
    
Dim a(3,4,5)
End Sub

Sub Reverse
End Sub

Sub Sort
End Sub

Sub SortKeysAndItems
End Sub
When it fails it compiles the Array with the wrong rank.
Code:
var__main_a = new String[,,] {(@"a"),(@"x"),(@"G"),(@"c"),(@"X"),(@"A"),(@"g"),(@"C"),(@"u"),(@"U")};
Whether this occurs or not is highly position dependant in the code. Remove one of those blank Subs and it will compile OK. I had various dims of a() around the code but this is as small as I can get it and still fail.

EDIT:- Damn! typoed the title yet again but Erel has quietly fixed it

Last edited by agraham : 08-28-2008 at 05:52 PM.
Reply With Quote
  #2 (permalink)  
Old 08-29-2008, 05:15 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,700
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

While it is legal to change the size of an array, you shouldn't change its rank (number of dimensions).
Similar code will fail in previous versions as well.

Basic4ppc doesn't compile the subs in any specific order. In this case it compiles sub Rank before AlSort. Therefore it treats the array as a three dimensions array (instead of one).
Reply With Quote
  #3 (permalink)  
Old 08-29-2008, 08:25 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Erel View Post
Basic4ppc doesn't compile the subs in any specific order. In this case it compiles sub Rank before AlSort. Therefore it treats the array as a three dimensions array (instead of one)
Thank you Erel, I sort of thought that was what was going on. I guess it is specific to the Array keyword that looks at the existing array before assignment.

Quote:
While it is legal to change the size of an array, you shouldn't change its rank (number of dimensions)
Changing rank seems to work without problems for normal Dims and assignments from libraries as they just assign a new array to the existing array variable without any checking.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
find keyword lijingtong Questions (Windows Mobile) 2 06-20-2008 09:05 AM
Auto Keyword im4retro Questions (Windows Mobile) 2 06-06-2008 03:45 PM
Problem with Optimized Compiler mikemputer Questions (Windows Mobile) 3 01-26-2008 02:00 PM
Comment after Do keyword Erel Bug Reports 1 07-24-2007 08:33 PM
filesearch keyword Cableguy Questions (Windows Mobile) 6 05-16-2007 05:44 PM


All times are GMT. The time now is 02:47 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0