Search found 12343 matches
- Feb 18, 2025 14:31
- Forum: Projects
- Topic: CShell Graphics shell in Freebasic Ide
- Replies: 18
- Views: 959
Re: CShell Graphics shell in Freebasic Ide
Begin by carefully studying and understanding Paul’s previous example.
- Feb 16, 2025 9:36
- Forum: Community Discussion
- Topic: Delete() doesn't respect the const-ness of pointers
- Replies: 4
- Views: 219
Re: Delete() doesn't respect the const-ness of pointers
Yes, it does protect against that:
Code: Select all
*(f.Bar) = -5
Code: Select all
var p = f.bar
*p = -5
- Feb 16, 2025 6:13
- Forum: Community Discussion
- Topic: Delete() doesn't respect the const-ness of pointers
- Replies: 4
- Views: 219
Re: Delete() doesn't respect the const-ness of pointers
To protect the data from modification (including deallocation), I would have declared 'as const long ptr' instead, but that does not change the behavior.
- Feb 14, 2025 9:42
- Forum: Documentation
- Topic: How to Manage a Critical Section of the code of a Thread in FB
- Replies: 38
- Views: 31101
Re: How to Manage a Critical Section of the code of a Thread in FB
and if at least two threads (including the main thread) use var-len strings.
- Feb 13, 2025 16:20
- Forum: Beginners
- Topic: Parser example problem
- Replies: 19
- Views: 1827
Re: Parser example problem
In FreeBASIC, True / False = -1 / 0 . If you absolutely want to get 1 / 0 instead, you can use for example: ElseIf operators = ">" Then comparisonResult = (total > currentNumber) Return Abs(comparisonResult) ElseIf operators = "<" Then comparisonResult = (total < currentNumber) R...
- Feb 12, 2025 6:15
- Forum: Documentation
- Topic: How to Manage a Critical Section of the code of a Thread in FB
- Replies: 38
- Views: 31101
Re: How to Manage a Critical Section of the code of a Thread in FB
This all follows my code analysis of badidea's crossword generator (https://www.freebasic.net/forum/viewtopic.php?p=306261#p306261) which was surprised to find no gain from multi-threading but rather a little loss. (see final improvement synthesis in https://www.freebasic.net/forum/viewtopic.php?p=3...
- Feb 07, 2025 12:20
- Forum: Documentation
- Topic: How to Manage a Critical Section of the code of a Thread in FB
- Replies: 38
- Views: 31101
Re: How to Manage a Critical Section of the code of a Thread in FB
Why is multi-threading performance heavily penalized by many manipulation of var-len strings and var-len arrays? For all pseudo-objects like var-len strings and var-len arrays, only the descriptors can be put into local memory but not the data itself which is always on the heap (only fixed-length d...
- Feb 01, 2025 19:44
- Forum: Beginners
- Topic: Neural Networks 1
- Replies: 12
- Views: 2011
Re: Neural Networks 1
Run-time error detected by compiling with the '-exx' option.
Your above correction fixes the bug.
Your above correction fixes the bug.
- Feb 01, 2025 17:43
- Forum: Beginners
- Topic: Neural Networks 1
- Replies: 12
- Views: 2011
Re: Neural Networks 1
Aborting due to runtime error 6 (out of bounds array access) at line 110 of C:\...\FBIde0.4.6r4_fbc1.20.0\FBIDETEMP.bas::NNINIT(),
'LAYER_SIZES' accessed with invalid index = 5, must be between 0 and 4
- Jan 31, 2025 19:31
- Forum: General
- Topic: Thread status polling - safe?
- Replies: 30
- Views: 3398
Re: Thread status polling - safe?
I am working on a version where all var-len strings have been transformed to 'zstring * 256'.
Therefore:
Code: Select all
type entry_type
dim as zstring * 256 word, clue
end type
- Jan 31, 2025 15:10
- Forum: General
- Topic: Thread status polling - safe?
- Replies: 30
- Views: 3398
Re: Thread status polling - safe?
From my last modified code, I added an optimization for the zstring assignment in the recursive function 'recursiveSmart1()' inside the For loop on 'ipw' : - Below, the line in comment is replaced the line that follows it: 'wordPlaced = entries.entry(ipw).word 'line optimized by the following line: ...
- Jan 31, 2025 7:04
- Forum: General
- Topic: Thread status polling - safe?
- Replies: 30
- Views: 3398
Re: Thread status polling - safe?
Indeed, I think that to be thread safe, all dynamic memory allocations/reallocations/deallocations requests are internally protected by a mutex. So concurrent requests will actually be serialized by this internal locking/unlocking of the mutex. This obviously happens when the user calls these reques...
- Jan 30, 2025 10:14
- Forum: General
- Topic: Thread status polling - safe?
- Replies: 30
- Views: 3398
Re: Thread status polling - safe?
The 'Space()' (or 'String()') function is a disaster for multi-threading with zstrings (compared to a loop using access by zstring indexes): Type Thread Dim As UInteger value Dim As Any Ptr pHandle Declare Static Sub thread1(ByVal pt As Thread Ptr) Declare Static Sub thread2(ByVal pt As Thread Ptr)...
- Jan 29, 2025 15:56
- Forum: General
- Topic: Thread status polling - safe?
- Replies: 30
- Views: 3398
Re: Thread status polling - safe?
This one erasedStr = space(len(word)) was an expensive operation. And not needed any more with zstring * 32. Just putting a 0 and the end now. Indeed, with a zstring, you just have to do: erasedStr[len(word)] = 0 '' erasedStr = space(len(word)) if wp.ori = 0 then 'horz for i as isz = 0 to len(word)...
- Jan 27, 2025 14:55
- Forum: General
- Topic: [Solved] Instr
- Replies: 4
- Views: 569
Re: Instr
Too good to be true! It is your test code for 'Mid()' that is buggy! After the first loop of [For i ... Next], 'mpos' is not reset to '1', so too easy for all tests of the following loops! Proposed modification: ' Using INSTR Dim s As String = "Hello, FreeBasic!" Dim found As Boolean = Fa...