Oxygen Basic

Programming => Problems & Solutions => Topic started by: Arnold on February 18, 2015, 05:18:04 AM

Title: Question about #Lookahead
Post by: Arnold on February 18, 2015, 05:18:04 AM
Hi Charles,

in examples\System there is a demo: MemLeakStrTest.o2bas which gives an error message. I do not know if this is expected? If I move function Replace above the line with sys i then the demo will work with or without #Lookahead.

I am not yet finished with modifying ruben2.o2bas to a bottom up arrangement. But I notice that there is a flow: Expression calls Term which calls Factor which calls Expression ... And there are many gosubs. In the moment I do not really look into the code, I only want to see the "No source" message.

Roland

Title: Re: Question about #Lookahead
Post by: Aurel on February 18, 2015, 07:59:39 AM
Quote
I am not yet finished with modifying ruben2.o2bas to a bottom up arrangement. But I notice that there is a flow: Expression calls Term which calls Factor which calls Expression ... And there are many gosubs. In the moment I do not really look into the code, I only want to see the "No source" message.

i don't have problem with this example probably because i use old dll ???

Roland
you can try updated source from ruben topic  ;)
Title: Re: Question about #Lookahead
Post by: Charles Pegge on February 18, 2015, 02:51:58 PM
Hi Roland,

An interesting case! #lookahead confused String the type with String() the function.

Thanks for spotting it.

Oxygen Update
http://www.oxygenbasic.org/o2zips/Oxygen.zip
Title: Re: Question about #Lookahead
Post by: Aurel on February 18, 2015, 11:05:34 PM
good to know is also if you declare all your user functions then you don't need lookahead ?
Title: Re: Question about #Lookahead
Post by: Arnold on February 19, 2015, 12:09:45 AM
Hi Charles,

I was not sure if this is a special case which should be omitted. If I use the first commented statement: String s = Space(2500) then the demo will work with #Lookahead. It will also work if I use:
 String s
 s = String(2500,"A")

the numbers are then displayed not so fast as when filled with Space. I am curious about the filename? If I look at gxo2.exe with my TaskManager, there is a slight increase of memory usage after pressing the key, but I assume this is because of allocating memory for the string?

Roland
Title: Re: Question about #Lookahead
Post by: Aurel on February 19, 2015, 01:09:50 AM
Arnold you must first declare
string s
then use s

anyway i have found that if /end if don't have proper error checking ???
Title: Re: Question about #Lookahead
Post by: Charles Pegge on February 19, 2015, 09:09:51 AM
Yes, this code was originally written by Mike to expose a memory leak, when monitored with Task Manager.