PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

if / else bug

PointOfLight · 05 Dec 2004, 05:19 UTC
I found a very interesting bug with the if / else structure. I'm not sure if it's exclusively with classes, but that's what I was doing when I encountered the error. I have the following code in one of the functions in a class I'm writing:

Code:

if(result$ <> SQLITE_OK)
errmsg$ = SQLERROR$;
return(false);
else if(row$ > 0)
Goto(data$, col$);
else
return(true);
end;


The class is in an include file, and if I create a program that includes the class file, when I try to run the program, I get a message saying that there is no entry point found in the main program I'm trying to run. I do have a procedure like so:

Code:

proc main
//do stuff
end;


Now if I change the if / else block to this:

Code:

if(result$ <> SQLITE_OK)
errmsg$ = SQLERROR$;
return(false);
else
Goto(data$, col$);
end;


which I can't really do, because it changes the meaning, or this:

Code:

if(result$ <> SQLITE_OK)
errmsg$ = SQLERROR$;
return(false);
end;

if(row$ > 0)
Goto(data$, col$);
end;


which is the same, so it's no big deal, it works fine. It just doesnt' seem to like the if / else if / else structure.
I was able to reproduce this problem, thanks for the detailed report. I have fixed it.

This is the code I have used to fix the problem:

Code:
#class myclass
forward func test
#endclass

func myclass.test
if (result$ <> 0)
errmsg$ = 1;
return (false);
else if (row$ > 0)
Goto(data$, col$);
else
return (true);
end;
end;

proc main
end;