Just starting out? Need help? Post your questions and find answers here.
-
Everything
- Enthusiast
- Posts: 224
- Joined: Sat Jul 07, 2018 6:50 pm
Post
by Everything »
Select + Goto inside always = Stack corruption.
Very basic example:
Code: Select all
Procedure test(val)
Select val
Case 1
;Do something
Case 2
;Do something
Default
Goto finalize
EndSelect
;Do something else
ProcedureReturn #True
finalize:
;cleanup
ProcedureReturn #False
EndProcedure
test(0)
I think this can be fixed.
-
Dude
- Addict
- Posts: 1907
- Joined: Mon Feb 16, 2015 2:49 pm
Post
by Dude »
It's not a bug if the manual says not to do it:
Manual for 'Goto' wrote:never use it inside a Select/EndSelect block
-
Everything
- Enthusiast
- Posts: 224
- Joined: Sat Jul 07, 2018 6:50 pm
Post
by Everything »
True
never use it inside a Select/EndSelect block (Unless you have the ability to manage the stack yourself, correctly.)
Not a big deal to fix stack manually, or use alternatives. My bad, don't read the docs first, now I know, thx!
-
Kiffi
- Addict
- Posts: 1357
- Joined: Tue Mar 02, 2004 1:20 pm
- Location: Amphibios 9
Post
by Kiffi »
Manual for 'Goto' wrote:never use it
Hygge
-
luis
- Addict
- Posts: 3876
- Joined: Wed Aug 31, 2005 11:09 pm
- Location: Italy
Post
by luis »
Manual for 'Goto' wrote:use it
-
User_Russian
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Post
by User_Russian »
Code: Select all
Procedure test(val)
Select val
Case 1
;Do something
Case 2
;Do something
Default
FakeReturn
Goto finalize
EndSelect
;Do something else
ProcedureReturn #True
finalize:
;cleanup
ProcedureReturn #False
EndProcedure
test(0)
-
Josh
- Addict
- Posts: 1183
- Joined: Sat Feb 13, 2010 3:45 pm
Post
by Josh »
User_Russian wrote:Code: Select all
Procedure test(val)
Select val
Case 1
;Do something
Case 2
;Do something
Default
FakeReturn
Goto finalize
EndSelect
;Do something else
ProcedureReturn #True
finalize:
;cleanup
ProcedureReturn #False
EndProcedure
test(0)
Good idea. I opened a request in Bugs/Documentation. Look
here
sorry for my bad english
-
Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Post
by Kwai chang caine »
@User-Russian
Waouuh !!
Thanks !! i have never see this command
Here is someone who use time for read the doc
The happiness is a road...
Not a destination