Search found 39 matches

by erik
Oct 13, 2023 12:41
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 269
Views: 24768

Re: Freebasic 1.20.0 Development

Improvement: Adding a warning for narrowing data type conversion. For example: Dim Big As LongInt Dim Small As Short = Big ' <-- the warning "narrowing conversion, possible data loss" is needed here Another example: Dim Small As Short Small = &hFFFFFFFF ' <-- a warning is needed here M...
by erik
Oct 06, 2023 10:55
Forum: Community Discussion
Topic: Bugs
Replies: 115
Views: 21222

Re: Bugs

For GCC the "-Wall -Wextra" or "-Wsign-compare" options must be enabled. However, even without these options, the number &h8000000000000000ll turns into -9223372036854775808ull. Comparing signed and unsigned numbers can be undefined behavior or turn into a potential problem i...
by erik
Oct 06, 2023 1:09
Forum: Community Discussion
Topic: Bugs
Replies: 115
Views: 21222

Re: Bugs

Very large numbers in the compiler source code produce strange intermediate code. In the file "symb.bi" on line 333 we have the constant FB_ARRAYDIM_UNKNOWN: '' Special value to represent the case where '...' ellipsis was given as ubound const FB_ARRAYDIM_UNKNOWN = &h8000000000000000ll...
by erik
Sep 29, 2023 14:11
Forum: Community Discussion
Topic: Bugs
Replies: 115
Views: 21222

Re: Bugs

This code:

Code: Select all

If ( __FB_ARGC__ = 1 ) Then
	Print 1
End If
Compile with:

Code: Select all

fbc64.exe -r file.bas
I get the error:

Code: Select all

file.bas(1) error 42: Variable not declared, __FB_ARGC__ in 'If ( __FB_ARGC__ = 1 ) Then'
When I compile without the "-r" option, there is no error.
by erik
Oct 19, 2022 6:46
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

We will not shift responsibility from the compiler to some "wrong task".
The inability to declare a structure larger than two gigabytes is a bug in the compiler, but not the wrong task at all.
by erik
Sep 21, 2022 16:47
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

That's not what I need.
I just need to declare a large structure.
I think the right solution would be to remove the structure size check from the compiler.
by erik
Sep 20, 2022 14:01
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

@fxm, but I can write code much easier if the structures were allowed to be larger than 2 gigabytes: Type Database Field1 As Long Field2 As Long ... End Type Dim p As Database Ptr = MapViewOfFile(...) p->Field1 = SomeValue1 p->Field2 = SomeValue2 However, I am getting a compilation error.
by erik
Sep 20, 2022 6:22
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

I have a long file with a certain structure. Instead of reading it byte by byte into memory, I decided to mapping it in memory. This way I get a pointer to memory. This memory is organized in a certain way, in the form of a data structure, so it is logical to cast a raw pointer to a pointer to the s...
by erik
Sep 19, 2022 17:53
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

@coderJeff, How do I declare a structure that takes up more than 2 gigabytes? Const capacity = &h0FFFFFFF ' 0FFF_FFFF Type Foo a1 As ZString * capacity a2 As ZString * capacity a3 As ZString * capacity a4 As ZString * capacity a5 As ZString * capacity a6 As ZString * capacity a7 As ZString * cap...
by erik
Sep 19, 2022 9:30
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

When using the "-std=c89" parameter, the backend will not issue warnings if you specify the constant specifier as a "long integer" or a "unsigned long integer": static int8 Vector1[4294967295ull]; static int8 Vector2[4294967295ll]; I think FreeBASIC should be fixed so t...
by erik
Sep 19, 2022 7:35
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

I compile in the standard way: "fbc64.exe test.bas", there are no GCC backend warnings here. When you compile with some other backend or in a non‐standard way, then such warnings should not be interpreted as valid. The 64‐bit platform allows you to address and use large blocks of memory, m...
by erik
Sep 18, 2022 17:39
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

String: fixed, variable-length or null-terminated (Zstring), up to 2GB long In this code, the variable takes up 4 gigabytes of memory and this does not cause a compilation error: Dim Shared AAA As ZString * Capacity Why does the compilation error appear only when the variable is a member of the str...
by erik
Sep 18, 2022 17:29
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

Re: error 51: User Defined Type too big

In this page https://www.freebasic.net/wiki/TblVarTypes
Zstring
32bit: +2147483647
64bit: +9223372036854775807

Which of these pages is correct?
by erik
Sep 18, 2022 15:54
Forum: General
Topic: error 51: User Defined Type too big
Replies: 34
Views: 3585

error 51: User Defined Type too big

I have 64-bit FreeBASIC. And the code: Const Capacity As ULongInt = &h00000000FFFFFFFF Type Foo x As ZString * Capacity End Type I get a compiler error: test.bas(7) error 51: User Defined Type too big in 'x As ZString * Capacity' And this code: Dim Shared AAA As ZString * Capacity compiles witho...
by erik
Jun 30, 2022 9:25
Forum: General
Topic: Feature request: strings in UDTs
Replies: 28
Views: 6196

Re: Feature request: strings in UDTs

All C functions expect a null‐terminated string. All WinAPI functions expect a null‐terminated string.
Therefore, the talk that the null character in the string is optional is not applicable in practice.