Search found 11963 matches

by fxm
Mar 29, 2024 20:05
Forum: Beginners
Topic: array initialization
Replies: 7
Views: 211

Re: array initialization

Without going that far, you can more simply encapsulate the declaration+initialization of your var-len array in a Type. This will cause the compiler to add a constructor, and an instance of this type can then be declared shared: type udt dim fruitname(0 to 2) as string => {"apple", "o...
by fxm
Mar 29, 2024 14:54
Forum: Sources, Examples, Tips and Tricks
Topic: Waterfall effect
Replies: 3
Views: 133

Re: Waterfall effect

Code: Select all

    For i As Integer = 0 To iNum - 1
by fxm
Mar 29, 2024 10:00
Forum: Beginners
Topic: array initialization
Replies: 7
Views: 211

Re: array initialization

Since fbc version 1.20.0, the compiler always pads the STRING*N type with spaces. If you do not want spaces on the right side of your string, use rather the ZSTRING*N type: dim shared fruitname(0 to 2) as zstring * 20 => {"apple", "orange", "banana"} (with this type ZST...
by fxm
Mar 26, 2024 17:25
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

Why not just use: #define C chr(0) Because const has higher operational efficiency :D Indeed, "Constants" have similar visibility rules than variables for Namespace blocks, Type blocks, and compound block statements, while "Defines" are only scoped inside compound block statemen...
by fxm
Mar 26, 2024 13:15
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

Why not just use:
#define C chr(0)
by fxm
Mar 26, 2024 12:04
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

St_W wrote: Dec 17, 2011 21:59 Automated recent git builds at:
https://users.freebasic-portal.de/stw/builds/
by fxm
Mar 25, 2024 17:00
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

Jeff, Back to : Pass Byref to a function, Return Byref from a function Assignment of the 3 types of string ( 'String' , 'String * N' , 'Zstring * N+1' ) by calling 2 types of function ( 'Byref As String' , 'Byref As Zstring' ): - either passing by reference to the function, - or returning by refere...
by fxm
Mar 25, 2024 7:23
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

The test-suite has some tests for [L|R]TRIM, however does not specifically test behaviours with CHR(0) either for the string argument or the filter argument. I think behaviour should be changed - however, there are several places internally where the rtlib uses common functions to scan a string for...
by fxm
Mar 24, 2024 9:58
Forum: Documentation
Topic: SmartPointer_UDTname_ segmentation violation
Replies: 10
Views: 372

Re: SmartPointer_UDTname_ segmentation violation

Documentation updated: ProPgOperatorOverloading → fxm [added in last example a workaround for a bug in fbc versions 1.10.0/1.10.1] This is due to a bad code generation for an argument passed to a 'Byval UDT Ptr' parameter when a specific conversion environment is encountered. The workaround consist...
by fxm
Mar 23, 2024 16:39
Forum: Documentation
Topic: SmartPointer_UDTname_ segmentation violation
Replies: 10
Views: 372

Re: SmartPointer_UDTname_ segmentation violation

Well done Jeff. Otherwise I had already seen another configuration which presents the same behavior: const SHOW_CHANGE = true type ROOT extends object Declare Constructor (Byref _name As String = "") #if SHOW_CHANGE Declare Operator Let (Byref rhs As root) '' same behavior with: Declare Co...
by fxm
Mar 23, 2024 10:02
Forum: Documentation
Topic: SmartPointer_UDTname_ segmentation violation
Replies: 10
Views: 372

Re: SmartPointer_UDTname_ segmentation violation

THANK YOU This "segmentation violation" signal only appears since version 1.10.0 of fbc. The simple change: Sub PrintInfo ( ByVal ByRef p As root Ptr) is enough to correct it (otherwise, the value of the pointer passed is polluted!!!). I will try to isolate/simplify this abnormal behavior,...
by fxm
Mar 22, 2024 16:54
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

Indeed, for very simple UDT with for example only numeric member fields without initializers: - the compiler does not add an implicit constructor but only allocates memory set to 0, - the compiler does not add an implicit copy-constructor but only performs a shallow (bitwise) copy, - the compiler do...
by fxm
Mar 22, 2024 6:12
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

There are cases where there are no constructors or copy-constructors or destructors (neither explicit nor implicit).
by fxm
Mar 21, 2024 19:23
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 228
Views: 20615

Re: Freebasic 1.20.0 Development

Even I am still learning about some keyword behaviors: For compatibility with QBasic, Lset can also copy a user defined type variable into another one. The copy is made byte for byte, without any care for fields or alignment. It's up to the programmer to take care for the validity of the result. [/i]
by fxm
Mar 20, 2024 19:31
Forum: General
Topic: wth -- Thread time .vs Subroutine time
Replies: 211
Views: 37682

Re: wth -- Thread time .vs Subroutine time

Thread synchronization is a fairly complex and very delicate subject to avoid all cases of blocking or asynchronism which are difficult both to highlight and to investigate.
This first requires great coding rigor.