Hi,
I noticed that "byte" variables are different from "integer" variable with respect to automatic conversion to String.
My test code:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
Private Sub toStringText
Dim s As String
Dim b As Byte = 5
Dim i As Integer = 6
Dim ll As Long = 7
Dim ib As Integer
debug.Print b ' gives an unprintable character (ASCII code 5?)
ib = b
debug.Print ib
s = b
debug.Print s ' gives an unprintable character (ASCII code 5?)
s = i
debug.Print s
s = ll
debug.Print s
End Sub
|
What Jabaco creates as Java code:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
private static void toStringText() { Exception Err = null; Exception h2 = null;
String s = "";
byte b = (byte)5;
int i = 6;
long ll = 7;
int ib = 0;
Global.Debug().Print(String.valueOf(Conversion.CInt(b)));
ib = Conversion.CInt(b);
Global.Debug().Print(String.valueOf(ib));
s = String.valueOf(Conversion.CInt(b));
Global.Debug().Print(s);
s = String.valueOf(i);
Global.Debug().Print(s);
s = String.valueOf(ll);
Global.Debug().Print(s);
}
|
My impression is that byte values are taken as ASCII character codes rather than as integer values.
In this respect, a byte is more a "char" than an "integer".
Greetings
A1880