Bug? Compiling fine on B4A, but error in B4i

Alessandro71

Well-Known Member
Licensed User
Longtime User
The following line compiles fine in B4A (i is the integer index in a For loop)
B4X:
Dim cellbyte As String = HexParser.Byte2Hex(0xAE + i)
The compiler error is
B4X:
invalid suffix '+_i' on integer constant

Same issue on this line:
B4X:
cellnumber = cellnumber - (0xAE - 0x40)
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
This code compiles fine:
B4X:
Dim cellnumber As Int
cellnumber = cellnumber - (0xAE - 0x40)

This is my output on a Release build

Rich (BB code):
B4i Version: 7.50
Parsing code.    (0.70s)
Building folders structure.    (0.25s)
Running custom action.    (0.04s)
Running custom action.    (0.03s)
Compiling code.    (0.76s)
Compiling layouts code.    (0.03s)
Building Xcode project.    (0.94s)
Preparing project for builder.    (1.53s)
    Project size: 3.73 MB
Sending data to remote compiler.    Error
B4i line: 5961
cellnumber = cellnumber - (0xAE - 0x40)
invalid suffix '-0x40' on integer constant
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I get the same error.

I got it to work by adding an extra pair of brackets

B4X:
    Dim cellnumber As Int
    cellnumber = cellnumber - ((0xAE) - 0x40)
 
Top