http://gilgamesh.hamsterrepublic.com/cgi-bin/bugzilla/show_bug.cgi?id=422
------- Comment #14 from [EMAIL PROTECTED] 2007-08-18 21:48 ------- Simpler testcase still, the GOSUB has nothing to do with this, only the act of jumping in and out of loops: fin = 5 for a = 0 TO fin goto test comeback: next a END test: for b = 13 to 14 print STR$(a) & "" next b goto comeback C:\FreeBASIC17>fbc -lang deprecated gosubtest.bas gosubtest.bas(14) warning 15(1): Branch crossing local variable definition, to label: COMEBACK, variable: LT_0003 C:\FreeBASIC17>gosubtest 0 0 Clearly FB0.17 treats the loop end variable as a temp variable and overwrites it when outside the FOR loop (with arguments to IntToStr, in this case). The counter is local variable accessible to a larger scope. When you use "as integer", the counter is also a temp variables and gets overwritten. So, that's all straightforward, we can create some rules for safely using FB0.17+: -No jumping out of a loop with a temp variable as end condition (except permanently) -Don't create variables with block scope anywhere GOSUBs or GOTOs are used. Stick to FB0.16 style scoping. So now we can check code to decide if it is FB 0.17+ safe. -- Configure bugmail: http://gilgamesh.hamsterrepublic.com/cgi-bin/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
