Allow ProcedureReturn & Break in Select/EndSelect Blocks

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Allow ProcedureReturn & Break in Select/EndSelect Blocks

Post by Tranquil »

Topic says all.

I was very astonished as I looked in the BUG-Reports section that this seems not to be allowed.

Break and ProcedureReturn should cleanup the stack in every situation it breaks out a look or a Select/ EndSelect block or the compiler should even give a warning on this.
Tranquil
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Post by eesau »

ProcedureReturn inside a Select/EndSelect-block works just fine or am I missing something?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

it works for me
x86 winXP sp3

Code: Select all

For i=0 To 10
   Select zero
      Case 0
         Debug "break - exit of loop"
         Break
   EndSelect
Next

Debug "ok"

Procedure test()
      Select zero
         Case 0
            Debug "ProcedureReturn - exit of procedure"
            ProcedureReturn
      EndSelect
EndProcedure

test()

Debug "ok"
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Yep I use it all the time.
I may look like a mule, but I'm not a complete ass.
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

Tranquil
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

the question to be answered is, if it is a QUAD problem.

if yes, it should be at least stated in the Help that Select is not suitable for Quads.

to my knowledge, the stack processing was fixed thus FakeEndSelect was removed.
History sais it was with 3.62

it was fixed for LONG-Selects, and if it wasn't extended meanwhile,
it's obvious that there will be a mistake now when the Select handles a Quad and the compiler cleans the Stack for a LONG-Select.
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Allow ProcedureReturn & Break in Select/EndSelect Bl

Post by Trond »

Tranquil wrote:Topic says all.

I was very astonished as I looked in the BUG-Reports section that this seems not to be allowed.

Break and ProcedureReturn should cleanup the stack in every situation it breaks out a look or a Select/ EndSelect block or the compiler should even give a warning on this.
This should be allowed, it must be a bug.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It should work.
Post Reply