Search found 7450 matches

by fxm
Dec 10, 2017 22:14
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

'Ermn' and 'Erfn' return non constant values (Zstring Ptr).
'Const' is a qualifier (not a function).
by fxm
Dec 10, 2017 20:09
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Is there any (optimization) advantage in FUNCTION () AS CONST STRING over FUNCTION() AS STRING? The generated code is exactly the same. The notion of constant datatype remains at the level of the only compiler. In Pascal, const in procedure definitions can result in code optimization. To optimize t...
by fxm
Dec 10, 2017 18:58
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Enum is only a declaration and does not return anything.
by fxm
Dec 10, 2017 17:30
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

I was talking about FreeBASIC keywords (not a function from an example in documentation).
Obviously, with our own function, we do what we want.
by fxm
Dec 10, 2017 16:41
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Isn't it easier just don't use const? Yes, but the "issue" is that some of FB's internal functions return const datatypes. On this subject, a little quiz? There is at least one FreeBASIC keyword that returns a constant data type (because I only know that one). What is (are) it (they), and...
by fxm
Dec 10, 2017 14:37
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

It shouldn't be an implicit conversion. Simply uncouple the pointer-const relationship. :-( Let the user be able to define 'Const DataType Ptr' pointers if he wants (including also the 3 configurations of the 'Const' qualifier in the pointer type)! Getting rid of the current illegal implicit conver...
by fxm
Dec 10, 2017 12:04
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

FreeBASIC also allows UBYTE = &h80 without any protest (it is up to the programmer to check this). At best, the compiler might give a hint (when chosen to) to let the programmer know what's going on. I agree with you that there are already plenty of implicit conversions (between built in dataty...
by fxm
Dec 10, 2017 10:41
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Remark about:

Code: Select all

Type PChar As Zstring Ptr
Type CPChar As Const Pchar
If 'PChar' is a 'ZSTRING PTR',
Warning: 'CONST PChar' in not a 'CONST ZSTRING PTR' but a 'ZSTRING CONST PTR'
by fxm
Dec 10, 2017 10:24
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

I like typed programming languages (this reduces the number of errors that are not detected by the compiler): - I always correct the code to cancel all the compile warning messages. - Often, this reveals variable declaration faults, and rarely I use explicit casting to solve a warning. - But even in...
by fxm
Dec 10, 2017 8:54
Forum: Tips and Tricks
Topic: Z Order
Replies: 11
Views: 262

Re: Z Order

Why work with a global (shared) rect array (r())? In addition, that forbids the copy-construction (because initialization is done before program beginning when using global variable). It's better to pass the rect array (r()) as a parameter to refresh(): #define MAXR 2 'max rect #define MAXW 800 'max...
by fxm
Dec 10, 2017 6:38
Forum: Tips and Tricks
Topic: Z Order
Replies: 11
Views: 262

Re: Z Order

A constructor is mandatory to fill the variable's fields of the rect instance (if at least one field value must be different from its default value) only because of the string field which request a construction itself. In that case, the syntax "instance = Type(.....)" does not work (bit-wi...
by fxm
Dec 09, 2017 21:13
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Note: In order to make calling the C runtime functions very easy, any string type argument may be directly passed to a procedure referring to a parameter declared as 'zstring ptr'. The compiler performs itself an automatic conversion (without warning message) between string and 'zstring ptr'. In th...
by fxm
Dec 09, 2017 17:34
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Munair wrote:But this thread gave me a lot of additional insight with issues not found in the documentation, which was very helpful.
Apart from my last update of the ZSTRING page, do you think there is still information missing in the documentation (related to your thinking around this thread)?
by fxm
Dec 09, 2017 16:41
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

General question: why do you want to work with pointer variables? In the example above that you gave, there is no improvement to working with pointer variables Have a look at the source code of the UTF-8 library under projects. There is quite some pointer arithmatic involved. The example here is ju...
by fxm
Dec 09, 2017 15:35
Forum: General
Topic: methods of accessing bytes by pointer
Replies: 116
Views: 849

Re: methods of accessing bytes by pointer

Therefore why not that structure: Sub something1(Byval pz As Zstring Ptr) Print *pz End Sub Sub something2(Byval pz As Const Zstring Ptr) Print *pz End Sub Dim As String s1 = "string#1" Dim As Const String s2 = "string#2" Dim As Zstring * 10 zs1 = "ztring#1" Dim As Cons...

Go to advanced search