Search found 10317 matches

by fxm
Jun 20, 2021 20:03
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

To be compatible both with fbc 64-bit and fbc 32-bit:
if (culngint(ptr_) mod alignment) = 0 then
if (cuint(ptr_) mod alignment) = 0 then

(similarly for the other expressions)
by fxm
Jun 20, 2021 15:51
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

The advantage of use Do / Loop / Continue Loop / Exit Loop (or similarly with For / While loops), compared to backward Goto, is that this naturally protects against possible fraudulent jumps that could corrupt the stack and so bug the program.
by fxm
Jun 20, 2021 13:07
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

How on earth does this work? ( flags and &h0000000f ) provides the number of dimensions allocated in the descriptor (and not the number of dimensions of the array which is the 'dimensions' field). The descriptor memory is allocated at the first array declaration. When the array is first...
by fxm
Jun 20, 2021 8:51
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

Only to show you an example here are vec4 aligned 16 bytes. ..... operator vec4 . cast as _VEC4 ptr return cptr(_VEC4 ptr,cast(uinteger,@memory) and MASK) end operator ..... operator vec4 . [] (byref index as const uinteger) byref as single return cptr(single ptr,cast(uinteger,@memory) and MASK)[in...
by fxm
Jun 20, 2021 7:16
Forum: Documentation
Topic: member operator [] in the compiled help file ?
Replies: 5
Views: 137

Re: member operator [] in the compiled help file ?

With the compiled .chm help file, you also have direct access by using the index list ( 'Operator [] (Pointer Index)' or '[] (Pointer Index)' ) Note: Each time before updating the .chm help file, first delete the .chw file to force rebuild the index list at its first ...
by fxm
Jun 20, 2021 5:09
Forum: Beginners
Topic: How to open just one window?
Replies: 2
Views: 103

Re: How to open just one window?

Quit program by using the close button (top and right) of the graphics window (detecting the Chr(255) & "k" string) :

Code: Select all

Screen 12
Do
    If Inkey = Chr(255) & "k" Then Exit Do
    Sleep 10
Loop
(see SCREEN (GRAPHICS), paragraph 'Other details')
by fxm
Jun 19, 2021 19:19
Forum: Documentation
Topic: member operator [] in the compiled help file ?
Replies: 5
Views: 137

Re: member operator [] in the compiled help file ?

At the keyword OPERATOR, there is a general page on all overloaded operators (clicking on '[]' call the keyword Operator [] (Pointer index)).
Otherwise, one can also access this last page for example from the catalog page Operator List.
by fxm
Jun 19, 2021 18:18
Forum: Documentation
Topic: member operator [] in the compiled help file ?
Replies: 5
Views: 137

Re: member operator [] in the compiled help file ?

As with many other simple member operators ('@', 'assignment_op' except 'let'), there is currently no specific page for the member operator '[]'.
by fxm
Jun 18, 2021 14:22
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

I, too, have had enough of my remarks being misinterpreted.
by fxm
Jun 18, 2021 12:09
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

dodicat wrote:What do you mean "nothing justifies the principle of your algorithm."?

My sentence has absolutely nothing contemptuous.
I'm just saying that there is no evidence that the algorithm you are using can achieve this goal of array alignment.
by fxm
Jun 18, 2021 11:36
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

With gas 32-bit: vec3() index_ptr 35995728 aligned(16) base_ptr 35995728 aligned(16) size 12 element_len 4 dimensions 1 flags 8 8 allocated dims dimtb(0).elements 3 dimtb(0).lbound 0 dimtb(0).ubound 2 vec4() index_ptr 11142320 aligned(16) base_ptr 11142320 aligned(16) size 16 element_len 4 dimension...
by fxm
Jun 17, 2021 14:51
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

fbc 1.08 32-bit, win 10: infinite loop (in 'align()') with my PC.
by fxm
Jun 17, 2021 12:11
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: [solved] Is the FreeBASIC array alignment safe ?

I don't see where is the problem.
If you un-comment this line
'delete b ' <--- b never deleted by FreeBASIC (the OS free all memory OK but)
that works.
(everything else would be unsafe)
by fxm
Jun 17, 2021 11:57
Forum: Community Discussion
Topic: FreeBASIC 1.08.1 and 1.09.0 Development
Replies: 10
Views: 369

Re: FreeBASIC 1.08.1 and 1.09.0 Development

outp is a function ('outp(byval as ushort, byval as long) as long') defined in win/intrin.bi (indirectly inluded by windows.bi)

To find it, compile this:

Code: Select all

Dim outp As String
#Include "windows.bi"
by fxm
Jun 17, 2021 11:26
Forum: General
Topic: [solved] Is the FreeBASIC array alignment safe ?
Replies: 37
Views: 812

Re: Is the FreeBASIC array alignment safe ?

D.J.Peters wrote:May be a TYPE in FreeBASIC with overloaded aligned NEW operator can be the solution.

Yes but only for a fix-len array inside a UDT.
See my second example at Operator New Overload documentation page.

Go to advanced search