From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Software landmines (loops) Date: 1998/09/02 Message-ID: #1/1 X-Deja-AN: 387230915 References: <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> <6rfra4$rul$1@nnrp1.dejanews.com> <35DBDD24.D003404D@calfp.co.uk> <6sbuod$fra$1@hirame.wwa.com> <35f51e53.48044143@ <904556531.666222@miso.it.uq.edu.au> <6sgror$je8$3@news.indigo.ie> <6sh3qn$9p2$1@hirame.wwa.com> <6simjo$jnh$1@hirame.wwa.com> <35eeea9b.2174586@news.erols.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-02T00:00:00+00:00 List-Id: In article "Rick Smith" writes: > Edward Yourdon, "Techniques of Program Structure and Design", > Prentice-Hall, 1975, pg 145. > "In order to test the entire program... This in turn strongly > suggests that each submodule should be > designed with a single entry point and a single exit; in turn, the entire > program can be described as a set of nested modules, each of which > has one entry and one exit." ... > " 1. Procedure calls, subroutine calls, function invocation -- any legal > call to a closed subroutine with one entry and one exit. ... Nice quotes, but you have to understand them. In the sense of these quotes it is not possible to have multiple entries or exits to subroutines in most modern languages. The multiple exits in this sense are what you get with longjumps in C--the subroutine returns to a place other than the one it was called from. The multiple entries were common in PL/I, where depending on the name in the call you would enter the same code at different points. Typical in fact was to have multiple profiles where the procedure had three or four different parameter profiles, and you called the correct one for the parameters you wanted to supply. All subprograms in most modern languages are closed subroutines in the sense of this quote--they have a single entry, and the returns all go to the same place. (Absent exceptions, Unix signals, and the like.) To put it more bluntly, "You young whipersnappers have no idea what programming was like in the old days. The languages we used had no concept of a subroutine, we had to simulate it with gotos. And some idiots would write subroutines that didn't return to the place they were called from. Made debugging almost impossible, I tell you." Seriously, at the time that Yourdon wrote those words, there were languages that had call stacks and closed subroutines, but a lot of code was still written in versions of Fortran and Cobol where reentrant subroutines were not supported. In really was a very different world back then. In fact significantly more than half of the new code that year was written in assembler of one form or another, but mostly for the IBM 360. The most modern language use (extensively) in this country was PL/I, and that allowed multiple entry, multiple exit subroutines. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...