Strange problem. Help!

BlitzMax Forums/BlitzMax Programming/Strange problem. Help!

grable(Posted 2007) [#1]
Im having strange problems with my latest project.
Everything was working up until an hour ago where i only did a recompile without changing any major code (im 99% sure).

And suddenly it starts to skip method calls in Release mode, and throw memory exceptions in debug mode.

I havent been able to reproduce it with a smaller sample im afraid.

As far as i can tell, this is the offending code:
Method FindRule:TParserElement( name:String)
	Print "** FindRule()"
	For Local r:TParserElement = EachIn Rules
		Print "** comparing " + r.Name + " == " + name
		If r.IsRule And (r.Name = name) Then Return r
	Next
EndMethod
	
Method Generate( stream:TStream)
	Function GenerateCharSearch( r:TParserElement)
		Select r.Tag
			Case PE_RULE
				Print "** looking up " + r.Value
				Local rule:TParserElement = FindRule( r.Value)			<---------
				If rule Then
					Print "** found " + r.Value
					Return GenerateCharSearch(rule)
				Else
					Throw "ERROR: undefined rule '" + r.Value + "'"
				EndIf
	.....


** looking up XXX is printed but but nothing else, not even whats inside FindRule()
and the "return" is allways null

Any pointers? im going crazy soon :(

EDIT: is there a limit to how many functions inside a method? or how big they are?


grable(Posted 2007) [#2]
I may have found the reason for it, it seems the method call from a function within a method returns bogus results.

could someone else test this plese?


it should print 1 but it prints 2 in release mode and throws a memory exception in debug mode.


DStastny(Posted 2007) [#3]
Nesting functions do not maitain scope to self as far as I know and although it compiles I think its producing crap.

Doug Stastny


grable(Posted 2007) [#4]
Bummer, i thougt that was the whole point of nested functions :/


Grey Alien(Posted 2007) [#5]
Nesting functions do not maitain scope to self
YEah that's correct and it is a bummer too, you can do that in delphi you see...