Search found 7544 matches

by fxm
Feb 17, 2018 20:54
Forum: General
Topic: static bitfield initialization
Replies: 4
Views: 70

Re: static bitfield initialization

This works if you define a constructor: Type MyType A as ushort B:1 as ubyte C:1 as ubyte declare constructor (byval us as ushort = 0, byval ub as ubyte = 0, byval uc as ubyte = 0) end type constructor MyType (byval us as ushort = 0, byval ub as ubyte = 0, byval uc as ubyte = 0) A = us B = ub C = uc...
by fxm
Feb 17, 2018 20:33
Forum: General
Topic: Illegal specification
Replies: 17
Views: 199

Re: Illegal specification

The allocated size of a zstring cannot be passed to a procedure because a zstring has no descriptor, and only a string character data address is passed to a procedure.
by fxm
Feb 17, 2018 20:06
Forum: General
Topic: Illegal specification
Replies: 17
Views: 199

Re: Illegal specification

Or:

Code: Select all

Function Jack( ByRef Jill As ZString ) As Long
Print Jill
Return 1
End Function

Dim x As ZString*20 = "0123456"

Jack( x )

Sleep
by fxm
Feb 17, 2018 16:51
Forum: General
Topic: Parallelization
Replies: 16
Views: 235

Re: Parallelization

Version example using ThreadCreate instead of ThreadCall: Type ThreadData Dim As Any Ptr pt Dim As Zstring Ptr pid Dim As Integer count Static As Any Ptr tlock End Type Dim As Any Ptr ThreadData.tlock Sub Thread( Byval p As Any Ptr ) Dim As Double t t = Timer With *Cptr( ThreadData Ptr, p ) Do Loop ...
by fxm
Feb 17, 2018 6:33
Forum: Documentation
Topic: Wiki structure and content
Replies: 31
Views: 382

Re: default value of basic types

When a standard type is created, there is a default value. At least boolean and integer do not have the default value indicated on the wiki. While the defaults are mentioned under the Variable Declarations topic, it is a little far down the page, and far away from the keyword definition. Does it ma...
by fxm
Feb 16, 2018 21:21
Forum: Beginners
Topic: Posting multiple prints on one line
Replies: 4
Views: 83

Re: Posting multiple prints on one line

For example:

Code: Select all

dim tribute(30) as string
dim i as integer

i = 0
do
    input tribute(i)
    i = i + 1
loop until i = 5

print "The tributes are as named below..."
i = 0
do
    print "Tribute"; i + 1, tribute(i)
    i = i + 1
loop until i = 5
sleep
by fxm
Feb 16, 2018 17:14
Forum: General
Topic: Parallelization
Replies: 16
Views: 235

Re: Parallelization

I already filled in a bug report and added a note in the ThreadCall documentation about this behavior: # 770 ThreadCall does not ensure that data for passing parameter to a thread are still maintained until its launch THREADCALL ..... WARNING: Presently when Threadcall involves to pass parameters to...
by fxm
Feb 15, 2018 20:06
Forum: Documentation
Topic: Wiki structure and content
Replies: 31
Views: 382

Re: default value of basic types

DIM
.....
Initializers
Arrays, variables, strings, and user defined types (UDTs) are initialized to zero (or False for Boolean) or null strings by default when they are created.
.....
by fxm
Feb 12, 2018 21:57
Forum: General
Topic: tmatrix N1 x N2 class
Replies: 2
Views: 93

Re: tmatrix N1 x N2 class

Example: type tmatrix dim as double m( any , any ) declare constructor ( ) declare constructor ( byval row as ulong , byval colom as ulong ) end type constructor tmatrix ( ) end constructor constructor tmatrix ( byval row as ulong , byval colom as ulong ) redim this.m( row - 1 , colom - 1 ) end cons...
by fxm
Feb 12, 2018 16:48
Forum: General
Topic: tmatrix N1 x N2 class
Replies: 2
Views: 93

Re: tmatrix N1 x N2 class

Not to mention the coding bugs above (on memory allocation / deallocation), why not just use a dynamic array field as a type member (sized in the same way by the constructor, but so the destructor becomes useless)? Matrix multiplication is defined only when the number of columns in the first matrix ...
by fxm
Feb 12, 2018 9:05
Forum: Game Dev
Topic: What is good cross platform gameloop?
Replies: 8
Views: 239

Re: What is good cross platform gameloop?

Number the particles between 0 and MAX_PARTICLES-1 (as for the array sizing) or between 1 and MAX_PARTICLES (as for the iterator loops) you must choose for the indexing, but do not mix the two.
by fxm
Feb 08, 2018 16:31
Forum: Beginners
Topic: how to read entire file?
Replies: 5
Views: 165

Re: how to read entire file?

Using a var-len string as buffer, pre-sized at the right value (the file size), you can also process the '0' characters (corresponding to the null bytes). Not tested: dim as long fl open "testfile" for binary access read as 1 fl=lof(1) dim as string s=string(fl,0) get #1,,s close 1 print s...
by fxm
Feb 05, 2018 20:47
Forum: Windows
Topic: Function pointers , Conversion from C
Replies: 16
Views: 510

Re: Function pointers , Conversion from C

Where the value of the function pointer is initialized with the address of the target function : pexcel12 = @function_name ? (If you had compiled with the "-exx" error checking option, you would probably get the following run-time error: Aborting due to runtime error 7 (null pointer access...
by fxm
Feb 03, 2018 6:05
Forum: General
Topic: Linked List from the documentation problem
Replies: 11
Views: 379

Re: Linked List from the documentation problem

In this code is Delete y deleting the n pointer data? Is it the same as Delete n? In looking at your code Delete @x, you are sending the Delete keyword an address. This tells me that in my code above, the data associated with pointer n is being deleted since y contains the same address as n. Yes, y...
by fxm
Feb 02, 2018 6:16
Forum: General
Topic: Linked List from the documentation problem
Replies: 11
Views: 379

Re: Linked List from the documentation problem

I was hoping I had shown enough info. You 'DELETE' a 'TToken' pointer (unknown type). 'DELETE pointer' destroys data referenced by the provided pointer value (the pointer type being the same as the data type to destroy). The pointer itself is not destroyed. 'DELETE' only applies on data created by ...

Go to advanced search