Nonsense, Ascii was removed to reduce the administrative overhead for the Pb team.nco2k wrote:same reason why ascii was removed.
allow GOTO to also jmp to integer variables (dynamic)
Re: allow GOTO to also jmp to integer variables (dynamic)
sorry for my bad english
- langinagel
- Enthusiast
- Posts: 131
- Joined: Fri Jan 28, 2005 11:53 pm
- Location: Germany
- Contact:
Re: allow GOTO to also jmp to integer variables (dynamic)
At least nice to see that my point of view is shared.
THX nco2k
THX nco2k
Re: allow GOTO to also jmp to integer variables (dynamic)
for GOSUB - it think it should be really removed, because procedures can do everything, that gosub can do, but i a better, easier way.
But Goto - goto is like an ejection seat. Don't use it every time, only on emergencys
There a reason, why, for example, a goto to a diffrent procedure is imposible. An Goto to a pointer can easlier cause very hard to detect errors. Also a jump outside a structure can theoretically cause really bad things.
Can you post a example-Code, where you need "Goto" on pointers? Maybe there is a simpler better Method to solve your problem.
But Goto - goto is like an ejection seat. Don't use it every time, only on emergencys

There a reason, why, for example, a goto to a diffrent procedure is imposible. An Goto to a pointer can easlier cause very hard to detect errors. Also a jump outside a structure can theoretically cause really bad things.
Can you post a example-Code, where you need "Goto" on pointers? Maybe there is a simpler better Method to solve your problem.
Re: allow GOTO to also jmp to integer variables (dynamic)
well the particular one that made me post the request was because i had to use inline assembly for a jmp into my jump table, a Goto would've been ideal and then i wouldn't need two CompilerIf/ElseIfs to handle jmp dword/qword for x86/64 http://purebasic.fr/english/viewtopic.php?f=12&t=67044GPI wrote:Can you post a example-Code, where you need "Goto" on pointers? Maybe there is a simpler better Method to solve your problem.
Re: allow GOTO to also jmp to integer variables (dynamic)
Or HereGPI wrote:Can you post a example-Code, where you need "Goto" on pointers? Maybe there is a simpler better Method to solve your problem.
sorry for my bad english
Re: allow GOTO to also jmp to integer variables (dynamic)
ok, thats a very spezific problem 
on C64-Basic there was a "on xx goto label1,label2,label3,label4..." - maybe this would be nice in PB.
But in your case maybe a Macro should be a good solution:
Macro is incomplete, because i don't know the command to access the protected variable

on C64-Basic there was a "on xx goto label1,label2,label3,label4..." - maybe this would be nice in PB.
But in your case maybe a Macro should be a good solution:
Code: Select all
Macro GotoVariable(Variable)
; CompilerIf #PB_Compiler_Procedure=""
CompilerIf #PB_Processor_x64
! jmp qword [v_#variable]
CompilerElse
! jmp dword [v_#variable]
CompilerEndIf
CompilerElse
;Sorry don't know how to access a protected Variable in Asm here....
CompilerEndIf
EndMacro
Procedure test2()
Protected a
a=?label
GotoVariable(a)
Debug "Never2"
label:
Debug "ok2"
EndProcedure
a=?label
GotoVariable(a)
Debug "never"
label:
Debug "OK"
test2()
- langinagel
- Enthusiast
- Posts: 131
- Joined: Fri Jan 28, 2005 11:53 pm
- Location: Germany
- Contact:
Re: allow GOTO to also jmp to integer variables (dynamic)
I remember the On x GOTO 100,200,300 command.
But in Purebasic we have Procedures.
Why not a SELECT instead?
Should be easier to maintain.
Greetings
LN
But in Purebasic we have Procedures.
Why not a SELECT instead?
Code: Select all
SELECT a
case 0
Procedure_1()
case 1
Procedure_2()
case 3
Procedure_3()
default
Procedure_1()
Endselect
Greetings
LN
Re: allow GOTO to also jmp to integer variables (dynamic)
But I'm not willing to to create some hundred procedureslanginagel wrote:But in Purebasic we have Procedures.
Always smoking a cigarette while the processor is calculating, wouldn't good for my healthlanginagel wrote:Why not a SELECT instead?Should be easier to maintain.Code: Select all
SELECT a case 0 Procedure_1() case 1 Procedure_2() case 3 Procedure_3() default Procedure_1() Endselect

sorry for my bad english
Re: allow GOTO to also jmp to integer variables (dynamic)
Keya wrote:well the particular one that made me post the request was because i had to use inline assembly for a jmp into my jump table, a Goto would've been ideal and then i wouldn't need two CompilerIf/ElseIfs to handle jmp dword/qword for x86/64 http://purebasic.fr/english/viewtopic.php?f=12&t=67044GPI wrote:Can you post a example-Code, where you need "Goto" on pointers? Maybe there is a simpler better Method to solve your problem.
But that's just a wrapper for the jmp instruction i'm already having to use, using the two CompilerIf/Else directives i mentioned it'd be good not to have to typeGPI wrote:But in your case maybe a Macro should be a good solution:Code: Select all
Macro GotoVariable(Variable) ; CompilerIf #PB_Compiler_Procedure="" CompilerIf #PB_Processor_x64 ! jmp qword [v_#variable] CompilerElse ! jmp dword [v_#variable] CompilerEndIf CompilerElse ;Sorry don't know how to access a protected Variable in Asm here.... CompilerEndIf EndMacro

