Freebasic 1.20.0 Development

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
Xusinboy Bekchanov
Posts: 877
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
coderJeff
Site Admin
Posts: 4380
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Freebasic 1.20.0 Development

Post by coderJeff »

Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
Xusinboy Bekchanov
Posts: 877
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

coderJeff wrote: Mar 31, 2025 8:29
Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
The last one is the one from 03/16/2025?
I have all the sources in UTF8 (BOM).
Xusinboy Bekchanov
Posts: 877
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

Xusinboy Bekchanov wrote: Apr 01, 2025 15:46
coderJeff wrote: Mar 31, 2025 8:29
Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
The last one is the one from 03/16/2025?
I have all the sources in UTF8 (BOM).
Hello, I found a solution to this problem. When copying the compiler from this link https://users.freebasic-portal.de/stw/builds/win64/ and copying the lib files without overwriting the existing lib files then this code works without problems. Thanks.
fxm
Moderator
Posts: 12531
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.20.0 Development

Post by fxm »

About the new fix-len string ('String * N') definition since fbc version 1.20.0
('String * N' now occupies N bytes and has no terminating null character)

Bug to initialize a structure mixing such fix-len string with numeric data.

Example using a temporary type as initializer:

Code: Select all

Type UDT0
    Dim As String * 10 s
End Type

Type UDT1
    Dim As Integer i
    Dim As String * 10 s
End Type

Type UDT2
    Dim As String * 10 s
    Dim As Integer i
End Type

Dim As UDT0 u0 = Type("FreeBASIC")     '' ok
Dim As UDT1 u1 = Type(1, "FreeBASIC")  '' compile error
Dim As UDT2 u2 = Type("FreeBASIC", 2)  '' compile error

Defining an explicit constructor solves the previous problem:

Code: Select all

Type UDT0
    Dim As String * 10 s
End Type

Type UDT1
    Dim As Integer i
    Dim As String * 10 s
    Declare Constructor(Byval _i As Integer, Byref _s As String)
End Type
Constructor UDT1(Byval _i As Integer, Byref _s As String)
    i = _i
    s = _s
End Constructor

Type UDT2
    Dim As String * 10 s
    Dim As Integer i
    Declare Constructor(Byref _s As String, Byval _i As Integer)
End Type
Constructor UDT2(Byref _s As String, Byval _i As Integer)
    s = _s
    i = _i
End Constructor

Dim As UDT0 u0 = Type("FreeBASIC")     '' ok
Dim As UDT1 u1 = Type(1, "FreeBASIC")  '' ok
Dim As UDT2 u2 = Type("FreeBASIC", 2)  '' ok
Post Reply