BBC BASIC for Windows
« Procs within Proc's »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:11pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Procs within Proc's  (Read 707 times)
MALCOLM
Guest
xx Procs within Proc's
« Thread started on: Mar 1st, 2009, 10:07pm »

I didn't get an answer to the exact case I was asking.

Is this a valid construction. I am not sure that I (or anyone) need it but...

DEF PROCa
...

DEF PROCb .......:ENDPROC

...

ENDPROC


Malcolm.

User IP Logged

Malcolm
Guest
xx Re: Procs within Proc's
« Reply #1 on: Mar 2nd, 2009, 04:41am »

Thinking about this and following the other thread I see that it is only the DEF part that gets registered as a start of a Procedure and therefore an address to jump to. The code continues until an ENDPROC and returns. So I can answer myself that it sees this just as two PROCs with no knowledge of their relationship one within the other.

Malcolm.

User IP Logged

JonR
New Member
Image


member is offline

Avatar




PM


Posts: 24
xx Re: Procs within Proc's
« Reply #2 on: Mar 15th, 2009, 7:04pm »

Yes that is a valid construction but of limited usefulness in the manner described. When called PROCa will be executed normally, the interpreter will treat the line beginning DEF as though it was a comment and continue executing PROCa. When you call PROCb the interpreter executes it as normal and exit at the ENDPROC.

If the ENDPROC for PROCb was conditional and execution fell through to the next line the interpreter would keep executing up to the ENDPROC associated with PROCa unless the code failed with an error.

If you find yourself writing code like that it is worth looking for a more elegant solution.
User IP Logged

Malcolm
Guest
xx Re: Procs within Proc's
« Reply #3 on: Mar 16th, 2009, 12:37am »

Thanks, Jon.

I agree with your sentiments.





User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls