Search found 12010 matches

by fxm
Oct 05, 2013 4:44
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

1) I'm not sure if we should guarantee that Peek returns a reference. It could have just been an oversight in the compiler... Yet it is written in the documentation about Peek: ..... Description: This procedure returns a reference to the value in memory given by a memory address, and is equivalent t...
by fxm
Oct 04, 2013 21:14
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

Yes TJF, by using PEEK is another solution: Dim As String s = "Hello FreeBASIC forum!": Print Len(s): Print '' First solution with pointer warning Dim As Integer Ptr pi1 = @s Print pi1[2] '' Second solution without pointer warning by using an intermediary Any Ptr Dim As Any Ptr pa2 = @s Di...
by fxm
Oct 04, 2013 19:04
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

@a[0] is not a ZSTRING PTR but an UBYTE PTR . It is a ZSTRING PTR in fbc-0.24, full sure! (It may have changed in newer versions.) Yes, you are right for: VAR a = "abcd" VAR p = @a[0] - Before fbc 0.90.1, 'p' is a 'ZSTRING PTR' and 'Print *p' outputs "abcd" . - From fbc 0.90.1, ...
by fxm
Oct 04, 2013 16:53
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

@TJF - I get a gcc warning here dim as string a = "abcd" dim as integer ptr p = @a[0]: ? p You should get this warning! @a[0] isn't an INTEGER PTR (pointing to 4 bytes). Instead it's a ZSTRING PTR (pointing to 1 byte). Imagine what happens when variable 'a' is empty or shorter than 3 byte...
by fxm
Oct 04, 2013 6:58
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

Another solution is to define a union of different types of pointer. Another good idea to avoid the warning. I added your solution to my original program using a little more concise variant, then a fifth lousy solution: Dim As String s = "Hello FreeBASIC forum!": Print Len(s): Print '' Fi...
by fxm
Oct 03, 2013 20:11
Forum: Community Discussion
Topic: my love of susp. ptr assignment
Replies: 25
Views: 2794

Re: my love of susp. ptr assignment

I hate the "suspicious pointer assignment" warning! A well-written code should try to avoid or solve such a warning while not use the Cast operator if possible. Sometimes a solution can be to use an intermediary "Any Type" pointer that is obviously compatible with any pointer typ...
by fxm
Oct 03, 2013 12:53
Forum: General
Topic: FBC hangs
Replies: 3
Views: 500

Re: FBC hangs

Yes, well seen: - It's OK up to fbc version 0.24.0 (08-19-2012): .....\FBIDETEMP.bas(1) error 9: Expected expression in 'If type' .....\FBIDETEMP.bas(1) error 32: Expected 'END IF' in 'If type' - For working fbc version 0.25.0 (01-26-2013), fbc does not hang but compiler runtime error: .....\FBIDETE...
by fxm
Oct 02, 2013 8:19
Forum: General
Topic: error 169: Invalid assignment/conversion [FBC 0.90.1]
Replies: 11
Views: 2912

Re: error 169: Invalid assignment/conversion [FBC 0.90.1]

Remark: I would have hoped that the compiler goes further in its rigor on the assignment with respect to the types. For example, I think this following assignment should be forbidden: Dim As String s = "Test string" Dim As Zstring * 4 z = "###" Print s s[4] = *@z ' should flag a...
by fxm
Sep 30, 2013 19:12
Forum: Community Discussion
Topic: Where can I get a Recent-Git-Build of FreeBASIC?
Replies: 639
Views: 176165

Re: Where can I get a Recent-Git-Build of FreeBASIC?

There wasn't any git build for some time but here we have one: fbc 0.91 for win32 - With this build, we obtain this error message a little weird in that case: Static As Integer Ptr p = New Integer Compiler output: .....\FBIDETEMP.bas(1) error 258: Local symbols can't be referenced in 'Static As Int...
by fxm
Sep 30, 2013 11:06
Forum: Projects
Topic: FB debugger : 3.02 32/64 BIT WDS/LNX..... (2023/07/05)
Replies: 762
Views: 300606

Re: Fbdebugger : 2.70

SARG wrote:A new version, see first post for details and the link for downloading.
Link Fbdebugger 2.70 is truncated in your first post.
Complete link:
http://users.freebasic-portal.de/sarg/f ... _09_29.zip

[Edit]
The link is now fixed!
by fxm
Sep 30, 2013 10:57
Forum: Beginners
Topic: Question on when MUTEX is needed
Replies: 9
Views: 2116

Re: Question on when MUTEX is needed

fxm wrote:Potential example for 'MutexCreate' keyword: .....
KeyPgMutexCreate ⇒ FxMwikki [Added one example for mutex use]
by fxm
Sep 28, 2013 13:01
Forum: Beginners
Topic: Question on when MUTEX is needed
Replies: 9
Views: 2116

Re: Question on when MUTEX is needed

Potential example for 'MutexCreate' keyword: A version better structured from my previous example (without global variables): - "Generic" thread UDT (with all member fields for thread processing). - "Generic" thread procedure (calling user procedure passing an any ptr parameter)...
by fxm
Sep 27, 2013 22:03
Forum: Beginners
Topic: Question on when MUTEX is needed
Replies: 9
Views: 2116

Re: Question on when MUTEX is needed

In documentation, I have just added clarification that mutexes and conditional variables can be used with all created user threads and also the main thread executing main program: - KeyPgMutexCreate ⇒ FxMwikki [Mutex can be used with all threads including the main thread executing main program] - Ke...
by fxm
Sep 27, 2013 12:59
Forum: Beginners
Topic: Question on when MUTEX is needed
Replies: 9
Views: 2116

Re: Question on when MUTEX is needed

If the main program only reads a set of shared variables&Arrays, and the thread is the only routine that writes into them, do I need to use MUTEX or CONDWAIT commands. It depends on what the main program is doing with the shared variables. For example, if it were watching two variables waiting ...