GLBasic forum

Main forum => Bug Reports => Topic started by: bigsofty on 2011-Jun-27

Title: Bug or feature?
Post by: bigsofty on 2011-Jun-27
Functions that are used like this, work...

Code (glbasic) Select
LOCAL myb%= init_myb(100)

but...

Code (glbasic) Select
GLOBAL myb%= init_myb(100)

... are never called, no error either?
Title: Re: Bug or feature?
Post by: Moru on 2011-Jun-27
Whatever Gernot says I never initiate a variable with a function, no matter what :-)
Title: Re: Bug or feature?
Post by: Kitty Hello on 2011-Jun-27
They should be called. But! Before the main starts. They might not STDOUT or DEBUG messages.

I tested and the correct value was assigned.
Title: Re: Bug or feature?
Post by: bigsofty on 2011-Jun-27
Hmm, its definitely not working with one of my functions... I'll try to create a better reproducible error listing.
Title: Re: Bug or feature?
Post by: bigsofty on 2011-Jun-27
OK, 2 files "test2.gbas" and "testlib.gbas"...

Code (glbasic) Select

LOCAL a% = test()
GLOBAL b% = test()
//b% = test() // Unremark me to see it working

DEBUG "a%="+a%+" b%="+b%+"\n"


and...

Code (glbasic) Select
TYPE myType
a#[]
ENDTYPE

GLOBAL myArr[] AS myType

FUNCTION test%:
LOCAL b AS myType
DIMPUSH myArr[], b
l% = LEN(myArr)-1
RETURN l%
ENDFUNCTION


Run to see error.

This is basically an abstraction of my code, I think it could be narrowed down a little further though.

Title: Re: Bug or feature?
Post by: Kitty Hello on 2011-Jun-27
a=1, b=2 - fine?
Title: Re: Bug or feature?
Post by: bigsofty on 2011-Jun-27
With remark in place, "a%=1 b%=0" for me?

BTW I'm using version 9.040
Title: Re: Bug or feature?
Post by: MrTAToad on 2011-Jun-27
Ahhh - Try V10 :)
Title: Re: Bug or feature?
Post by: bigsofty on 2011-Jun-27
Ooh ran out of time today, I'll give a wee go 1st thing tomorrow.  ;)
Title: Re: Bug or feature?
Post by: MrTAToad on 2011-Jun-27
It works in V10 - whether in 1 file or multiple ones :)
Title: Re: Bug or feature?
Post by: bigsofty on 2011-Jun-28
OK, confirmed, this has been fixed in the current V10 beta!  =D