Search found 9432 matches

by fxm
Feb 19, 2020 16:30
Forum: General
Topic: Macro problem
Replies: 9
Views: 144

Re: Macro problem

I will try to add a note in the documentation. Perhaps like this in the #define documentation page: ..... Parameters turn a define into a function-like macro, allowing text arguments to be passed to the macro. Any occurrences of the parameter names in the body will be replaced by the given argument...
by fxm
Feb 19, 2020 15:53
Forum: General
Topic: Macro problem
Replies: 9
Views: 144

Re: Macro problem

Modified macro: #Macro VeryHiResSleep( n ) ' n >= 2 Scope Dim As Integer n0 = n Dim As ULongInt Target, Now QueryPerformanceCounter Cast( Large_Integer Ptr, @Now ) If n0 < 2 Then n0 = 2 Target = Now + n0*liFreq/1000 Sleep ( n0-2, 1 ) ' Class B amplifier Do QueryPerformanceCounter Cast( Large_Integer...
by fxm
Feb 19, 2020 15:48
Forum: General
Topic: Macro problem
Replies: 9
Views: 144

Re: Macro problem

Indeed, the equivalent code using a procedure works: Sub VeryHiResSleep( n As Integer ) ' n >= 2 ' Scope Dim As ULongInt Target, Now QueryPerformanceCounter Cast( Large_Integer Ptr, @Now ) If n < 2 Then n = 2 Target = Now + n*liFreq/1000 Sleep ( n-2, 1 ) ' Class B amplifier Do QueryPerformanceCounte...
by fxm
Feb 19, 2020 15:30
Forum: General
Topic: Macro problem
Replies: 9
Views: 144

Re: Macro problem

A macro can not modify a passed literal but only a passed variable:

Code: Select all

Dim As Integer n = 5
VeryHiResSleep( n )

Compiling with the '-pp' option allows you to easily debug the resulting '*.pp.bas' file.
by fxm
Feb 17, 2020 13:53
Forum: Community Discussion
Topic: FreeBASIC syntax challenge games
Replies: 415
Views: 24789

Re: FreeBASIC syntax challenge games

I have given my solution here.
by fxm
Feb 13, 2020 7:13
Forum: General
Topic: [solved] problem with operator let ?
Replies: 11
Views: 310

Re: [solved] problem with operator let ?

Member arrays are fully taken into account by the implicit copy constructor and the implicit let operator, for all that concerns resizing and copying of all elements from the source array to the destination array. Arrays are therefore considered as objects, but only when they are members of a UDT an...
by fxm
Feb 11, 2020 21:53
Forum: General
Topic: [solved] problem with operator let ?
Replies: 11
Views: 310

Re: [solved] problem with operator let ?

To go further on the subject, there is a case where the copy-assignment operator can replace the implicit copy-constructor operator. Looking at my Constructors, '=' Assignment-Operators, and Destructors (advanced, part #2) article: (see the condition combination in red ) Compiler int...
by fxm
Feb 11, 2020 17:45
Forum: General
Topic: [solved] problem with operator let ?
Replies: 11
Views: 310

Re: problem with operator let ?

Quick glance over the FBC source: It looks like DIM and VAR are very different. What happens if you use DIM instead of VAR? This should be similar. 'var d = c' or 'dim as tVector d = c' is a short cut for the explicit syntax 'var d = tVector(c)' or 'dim as tVecto...
by fxm
Feb 10, 2020 22:34
Forum: General
Topic: pointer, core dump error
Replies: 10
Views: 251

Re: pointer, core dump error

DIM SHARED as double reag_year(200), reag_inventory(k), reag_price(200), reag_mw(200)
DIM SHARED as double reag_year(200), reag_inventory(200), reag_price(200), reag_mw(200)
by fxm
Feb 10, 2020 6:32
Forum: Windows
Topic: Function name decoration issue
Replies: 13
Views: 463

Re: Function name decoration issue

If we emulate what FreeBASIC does under the hood to pass a string by value, we find a time equivalent to true passing by value: sub dothis(byval s as string) s+=" zzz" end sub sub dothis2(byref s as string) s+=" zzz" end sub dim as long lim=1000000 dim as double t dim as string x...
by fxm
Feb 10, 2020 6:05
Forum: General
Topic: ON ERROR GOTO to display problem line
Replies: 52
Views: 1286

Re: ON ERROR GOTO to display problem line

Are you running your program in full-screen mode ? (what exactly is your 'Screenres ...' instruction ?). If so, try to run it in windowed-screen mode. ? Suggestion: Why not present this code that solidly works and have you modify it to have the time displayed as a result of a thread? The co...
by fxm
Feb 09, 2020 19:16
Forum: Documentation
Topic: Wiki improvements
Replies: 395
Views: 65606

Re: Wiki improvements

Done (according to my post above):
ProPgStaticLibraries → fxm [added advanced example of OOP static library]
by fxm
Feb 09, 2020 14:00
Forum: Documentation
Topic: Wiki improvements
Replies: 395
Views: 65606

Re: Wiki improvements

A short OOP example for static and shared lib's would be a nice to have :-) For example: https://www.freebasic.net/forum/viewtopic.php?p=236630#p236630 Perhaps a similar example could be added in the 'Static Libraries' or/and 'Shared Libraries (DLLs)' pages of the 'Programme...
by fxm
Feb 08, 2020 9:22
Forum: Documentation
Topic: Wiki improvements
Replies: 395
Views: 65606

Re: Wiki improvements

For example:
viewtopic.php?p=236630#p236630

Perhaps a similar example could be added in the 'Static Libraries' or/and 'Shared Libraries (DLLs)' pages of the 'Programmer's Guide' ?
by fxm
Feb 07, 2020 16:02
Forum: Windows
Topic: Function name decoration issue
Replies: 13
Views: 463

Re: Function name decoration issue

But presently (for 32-bit compilation): - Passing a string by reference => @4 (see above) - Passing a string by value => @12 (see above) That is illogical because when a string is passed by value, in fact a copy of the original string is passed by reference! In both cases, a string is always passed ...

Go to advanced search