Re: Use of subroutines

From: Pterostyrax (pterostyrax_at_yahoo.com)
Date: 02/29/04


Date: 28 Feb 2004 15:03:18 -0800


"Kevin G. Rhoads" <Kevin.Rhoads@Dartmouth.edu> wrote in message news:<4040D2AE.421B18DB@Dartmouth.edu>...
> >I still maintain that a subroutine is first and foremost a GOTO
> >statement.
>
> GOTO transfers control with no provision to return and continue
> execution.
>
> CALL transfers control with built-in provision to return and
> continue execution.
>
> In assembly programming, this may be the only difference.
> In HLL programming, the subroutine has a different context,
> name space, variable scoping and may or may not have a
> different run-time address space.
>
> These are not the only differences, but they are highly
> non-trivial differences.
>
> Q1: Had you heard of any of these before?
> Q2: Do you understand what these things mean?
>
> If you cannot answer with an unreserved "yes" to
> both, then I think you need to learn of these
> concepts and issues before proceeding.
>
> I'd be happy to take a crack at answering if
> you have questions on any of the above, just
> ask.
>
> Sincerely
> Kevin

Well, first, all my comments have been with reference to Fortran - I
assumed that every one else would make that assumption in a Fortran
newsgroup. I never originally stated that GOTOs were EXACTLY the same
as a subroutine. I merely pointed out that CALLs to subroutines
behaved exactly like GOTOs when looking at logic flow in a program.
RETURNs behave exactly the same as well. Of course there are a number
of differences between the two and I am surprised that you could
interpret my original post in that way.



Relevant Pages

  • Re: Problem writing code to go to a label after calling a procedure
    ... >>I first tried to create procedures for parts of the program to avoid ... Thanks for the advice J French. ... I know a good program structure avoids many goto ... subroutine, this is somthing I found that Visual Basic can't do. ...
    (comp.lang.basic.visual.misc)
  • Re: Use of subroutines
    ... Go tos are not evil. ... >I still maintain that a subroutine is first and foremost a GOTO ...
    (comp.lang.fortran)
  • Re: Use of subroutines
    ... >>I still maintain that a subroutine is first and foremost a GOTO ... > Kind of like sending out for a pizza. ... The original programmer may never have ...
    (comp.lang.fortran)
  • Re: When MV is not an option
    ... Each prompt calls a local subroutine to validate some test. ... a GoTo or STOP. ... >programming language... ...
    (comp.databases.pick)
  • Re: global interpreter lock
    ... I doubt a language for thread-phobes has much of a future. ... require a fundamental redesign of the underlying execution hardware, ... All modern CPUs allow flow control through the use of machine-code/assembly instructions which branch, either conditionally or unconditionally, to either a relative or absolute memory address, i.e. a GOTO. ... To really have parallel execution with clean modularity requires a hardware redesign at the CPU level, where code units, executing in parallel, are fed a series of data/work-units. ...
    (comp.lang.python)