Gosub in procedures

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by dmoc.

.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Sebi.

You can do this in the current version of PB with already with the following code:

Code: Select all

CallFunctionFast(?GoSub_Label)
But I agree! The message 'GoSub not allowed inside a Procedure' is not very useful.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by dmoc.

Cheers Sebi, I didn't know that!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by Sebi

But I agree! The message 'GoSub not allowed inside a Procedure' is not very useful.
Would there be stack problems if you Gosub'bed out of a procedure? Not in the sense that your stack would get mangled, but if you jumped into some global code or another procedure then variables would not necessarily be in the same indexed memory locations.

Although I think global variables are always accessed absolutely?

Allowing gosub within a procedure might be OK?


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, external editor)
Post Reply