Search found 2816 matches

by MrSwiss
Dec 08, 2018 20:34
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

Munair, you might want to stop parroting, it makes you appearing, far less than clever ...
by MrSwiss
Dec 08, 2018 20:10
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

I don't need to give you any code, because you've 'spelled it out' yourself:
any UDT containing a: var-len array ...
Therfore you're wrong (or at least: incomplete).
by MrSwiss
Dec 08, 2018 19:22
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

fxm wrote:This type of optimization is only applied to var-len strings because the "value" of a var-len string is its descriptor.

No, incorrect, it also applies as well, to any UDT (which in fact is, what a FB-string is too).
by MrSwiss
Dec 08, 2018 14:18
Forum: General
Topic: How to fix error 177 ???
Replies: 40
Views: 554

Re: How to fix error 177 ???

paul doe wrote:I would define the Null pointer as: #define Null cptr( any ptr, 0 )

Another way would be a (global) constant (not only good for OO stuff, but procedural also):
Const As Any Ptr NULL = 0
More efficient than a #Define (a single line #Macro).
by MrSwiss
Dec 06, 2018 22:03
Forum: General
Topic: Using REDIM in a UDT ?
Replies: 6
Views: 120

Re: Using REDIM in a UDT ?

@dodicat, SOMEWHERE, is still at: http://users.freebasic-portal.de/stw/builds/ freebasic_manual.chm (latest build date = file date) Usually rebuilt, whenever a change in the Wiki (online manual), is detected. (automatic build, during early morning: 3:30-4:30 AM) @BasicCoder2, plse. use FB Wiki (as o...
by MrSwiss
Dec 06, 2018 21:42
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

Lost Zergling wrote:Fake ! => this is just what it look likes but compiler behaves with ptr assignment

The Ptr stuff, is required to: handle, any FB intrinsic data-type.
(no other reason, I can imagine)
by MrSwiss
Dec 06, 2018 18:02
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

First: you are quoting out of context (makes no sense at all). Second: you are freely mixing, ZString Ptr (changing) & indexing a ZString (dereferenced ZString Ptr). The two of them are, so to speak: "a different pair of shoes". What I've been referring to, is only: indexing a ZString ...
by MrSwiss
Dec 06, 2018 16:55
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

When iterating through a zstring the pz[a][b] notation would allow for comfortable assignment leaving the zstring pointer (pz) at the beginning of the string data. Sorry but, you really have some funny ideas (about FB, at least). The ZString Ptr (because, there is only one ZString) isn't ever modif...
by MrSwiss
Dec 06, 2018 16:30
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

I'm only talking about 'getters', nothing to do with 'initializing' or 'setters'.
by MrSwiss
Dec 06, 2018 15:55
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

on topic, again: pz[i][j] notation, should IMO only be used on a: ZString Ptr Ptr (a ZString Ptr array, with char access) used as follows: *pz[i] for the whole ZString and, pz[i][j] for a char (UByte) on ZString Ptr , the notation should be: *pz for the whole ZString and, pz[i + j] for a char (UByte)
by MrSwiss
Dec 06, 2018 15: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()

[off topic] The purpose of swap in this context (in my mind) is to make a local variable "virtually static" in memory so as to minimize stack calls and/or backend dealloc/realloc. I see it as if using stack was a little bit like using processor cache...partially thrue I think Swap just doe...
by MrSwiss
Dec 05, 2018 15:29
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

Your code, written properly (see comments): dim s as string = "FreeBASIC!" dim z as zstring ptr = strptr(s) dim c as string * 1 dim a as ubyte c = z[6] a = z[6] c = Chr(s[6]) ' badly needed conversion! you are assigning a string! a = s[6] ' a UByte = no problem! Sleep Maybe, you understand...
by MrSwiss
Dec 05, 2018 13:11
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

@Munair, if you don't understand something , then it's also you, that has to do the re-read, ( maybe for a change, also the FB-Manual? ) of the posted answers, until you figure it out ! Writing #Define's/#Macro's without understanding, what's below the surface, is useless ... (because: you don't rea...
by MrSwiss
Dec 04, 2018 23:03
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

You use byte, not string. I'm using, what you obviously don't understand ... Something like: s[n] returns a UByte , not any sort of string. Therefore, a UByte must be used for assignment, too. E.g. Asc("X") . ' assume s being a string Dim As UByte ub = s[n] ' get a "string-ch...
by MrSwiss
Dec 04, 2018 22:48
Forum: Tips and Tricks
Topic: Get String Characters 4x Faster than Mid()
Replies: 83
Views: 1605

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

Munair wrote:syntax s[6], which does not allow assignment to string

Which is of course, nonsense (see code example)!

Go to advanced search