Search found 8491 matches

by fxm
Dec 09, 2018 8:51
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

The first problem is that 'two.One' is not declared as reference because 'One' is a non-static normal declared field. 'One' field should be declared as non-static reference (with syntax for example: 'byref One as TOne ...' ), but FreeBASIC does not support it at prese...
by fxm
Dec 09, 2018 7:31
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

Munair wrote:references to objects within objects cannot be null referenced (yet) without using pointers.

Can you give a simple example of this handicap, to see if we can still do something?
by fxm
Dec 08, 2018 20:27
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

Re: Get String Characters 4x Faster than Mid()

For UDT instances, swapping is applied on each field.
Optimization only at the level of the var-len string/array fields.
by fxm
Dec 08, 2018 19:56
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

Re: Get String Characters 4x Faster than Mid()

No IMHO, optimization only for the UDT fields data that are descriptors in fact:
- var-len string fields
- var-len arrays
An object instance has no global descriptor.

If I'm wrong, show me a code example.
by fxm
Dec 08, 2018 17:58
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

Re: Get String Characters 4x Faster than Mid()

This type of optimization is only applied to var-len strings because the "value" of a var-len string is its descriptor. Only the contents of descriptors are exchanged and not the character data themselves: Dim As String s1 = "1" Dim As String s2 = "2" Print "descri...
by fxm
Dec 08, 2018 14:42
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

dodicat wrote:fxm
your example gives
Compiler output:
Aborting due to runtime error 12 ("segmentation violation" signal) in 32 bit gas and gcc
And compile failed with no reason shown in 64 bit gcc.

Bug now fixed in Rev 1.06.
by fxm
Dec 08, 2018 14:41
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

In FreeBASIC, anything that can be done with pointers can be done with references (because a reference is the dereferencing of an internal pointer, but accessible by user). Not true, because there's no orthogonality between references and pointers Yes in that case, because non static reference fiel...
by fxm
Dec 08, 2018 12:24
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

Since in FreeBasic you can't do late binding of references, there's not much else you can do when/if you start working with interfaces. In FreeBASIC, anything that can be done with pointers can be done with references (because a reference is the dereferencing of an internal pointer, but accessible ...
by fxm
Dec 07, 2018 22:26
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

Re: Get String Characters 4x Faster than Mid()

If you have another reference for each of the two variables, you can not reason as a name permutation because it was as if the other alias names were also implicitly permuted: Dim As Integer I1 = 1, I2 = 2 Dim Byref As Integer RI1 = I1, RI2 = I2 Print I1, I2 Print RI1, RI2 Print Swap I1, I2 Print I1...
by fxm
Dec 07, 2018 12:51
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

I was under the impression that the "invalid data types" error is due to the byref clause, not because the object is temporary. Not exactly. With a local instance, no compiler error but the program does not run as wanted: type TT extends object s as string declare constructor() end type c...
by fxm
Dec 07, 2018 12:34
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

Yes. For the bugged code, the compiler does not complain because a hacked expression is used to create first the null reference: dim byref t as TT = *cptr(TT ptr, 0) @t = @TT() If you attempt to directly create a reference on a temporary object: dim byref t as TT = TT() "...
by fxm
Dec 07, 2018 12:08
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

In FreeBASIC, a reference is in fact an internal pointer (created by the compiler) which is implicitly dereferenced when user want to access the reference. In the bugged code, the internal pointer points to a local instance (which is so destroyed when returning from the function). For more informati...
by fxm
Dec 07, 2018 10:41
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

Your above code is not safe because 'TT()' is a local instance in the function body. Similar example to highlight the bug: type TT extends object s as string declare constructor() end type constructor TT() print "TT called" end constructor function SomeTT(byval b as boolean...
by fxm
Dec 07, 2018 6:36
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

Yes.
The implicit typename is the one specified as return in the function declaration.

Go to advanced search