Android Question Compilation differences in legacy and rapid debug

Arf

Well-Known Member
Licensed User
Longtime User
Still fighting with the arithmetic/casts problem I posted about on the another thread, things are just getting stranger. I've been using only rapid debug, I changed to legacy to see if any difference is made, and I get a compile error that I don't get in rapid debug:

Error description: Cannot cast: {Type=Char,Rank=0, RemoteObject=True} to number.
B4X:
Sub AdvanceOutBuf (indx1 As Char)
    Do While indx1 > 0      'the error is with this line
        GetNextByte
        indx1 = indx1 - 1
    Loop
End Sub

Is this expected? I am not sure what's wrong with my function, will try rewrite it.
 

stevel05

Expert
Licensed User
Longtime User
Yes, Char (Character in java) is a data type that is intended to be used to manipulate unicode characters, you need to use int for this purpose.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Wooohooo! I am over the moon.. I've had so many strange things start happening in the last 24 hours (ever since I started using Char here and there), mass replaced them to Ints and everything working 100% reliably again.. Thanks for the help, much appreciated!
 
Upvote 0
Top