Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:06:57+00:00 2026-05-14T04:06:57+00:00

I have a strange question concerning subroutines: As I’m creating a minimal language and

  • 0

I have a strange question concerning subroutines: As I’m creating a minimal language and I don’t want to add high-level loops like while or for I was planning on just adding gotos to keep it Turing-Complete.

Now I thought, eww – gotos – I wouldn’t want to program in that language if I had to use gotos so often. So I thought about adding subroutines instead.

I see the difference as the following:

  • gotos

    • Go to (captain obvious) a previously defined point and continue executing the program from there. Leads to hardly understandable and buggy code, I think that’s a fact.
  • subroutines

    • Similiar: You define their starting point somewhere, as you call them the program jumps there – but the subroutine can go back to the point it was called from with return.

Okay. Why didn’t I just add the more function-like, nice looking subroutines? Because:

In order to make return work if I call subroutines from within subroutines from within other subroutines, I’d have to use a stack containing the point where the currently running subroutine came from at top.

That would then mean that I would, if I create loops using the subroutines, end up with an extremely memory-eating, overflowing stack with return locations. Not good.

Don’t think of my subroutines as functions. They are just gotos that return to the point they were called from, they don’t actually give back values like the return x; statement in nearly all today’s languages.

Now to my actual questions:

  • How can I solve the above problem with the stack overflow on loops with subroutines? Do I have to add a separate goto language construct without the return option?

  • Assembler doesn’t have loops but as I have seen myJumpPoint:, jnz, jz, retn. That means to me that there must also be a stack containing all the return locations.

    • Am I right with that?
    • What about long running loops then? Don’t they overflow the stack/eat memory then?
    • Am I getting the retn symbol in assembler totally wrong? If yes, please explain it to me.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:06:58+00:00Added an answer on May 14, 2026 at 4:06 am

    Well, couldn’t you solve that problem with a conditional jump? A loop checks some condition to see if it has to run again. Go with your subroutines, but add a conditional return, that either returns to the point of call, or returns to the beginning of the routine depending on the evaluation of the condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have probem / strange question, i got algorithm with few for loops and
Strange question, I know. I don't want to delete all the rows and start
So I have a strange question. I have written a script that re-formats data
I know it is a strange question did someone have had a case where
I know it's a simple question, but I have strange behaviour in here. <pre>
Right, bit of a strange question; I have been doing some linq to XML
Strange, but I can't find a duplicate for this question. I have a superclass
I have a very strange question. I have a class/function : class MCBSystem {
Here's a strange question for you guys, I have a nice sorted list that
This could be a kind of strange question. I have a php file in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.