dgary@ecsvax.UUCP (07/10/84)
<> If you think arithmetic IFs in FORTRAN are bad... Both FORTRAN and COBOL offer redirectable goto statements. E.g. in COBOL (just for variety) one can write ... INSIDIOUS-PARAGRAPH. GO TO MILWAUKEE. ... ALTER INSIDIOUS-PARAGRAPH TO PROCEED TO GOBI-DESERT. And guess what happens when code hits GO TO MILWAUKEE. (Well, it depends on whether the ALTER has been executed.) ALTER was removed from a recent COBOL standard and the response from the DP community was furious (there are these old programs, see...) and I got out of active COBOL programming before the controversy was settled. Anyway, this is the a-number-one HORRIBLE programming feature of all time!!!!! D Gary Grady Duke University Computation Center, Durham, NC 27706 (919) 684-4146 USENET: {decvax,ihnp4,akgua,etc.}!mcnc!ecsvax!dgary
donn@hp-dcd.UUCP (donn) (07/10/84)
From what I remember of COBOL, there is a consequence of the ALTER statement in the langauge that may be worse than the ALTER itself. That's the semantics of PERFORM, the sort-of-subroutine call. It permits specifying the beginning and end of the subroutine: PERFORM a THRU b. Thus you can create the following mess (where the arrows indicate the range of two perform statements): A. ...... <---- B. | ...... | <---- C. | | ...... <---- | D. | ...... <---- E. ...... Since PERFORM A THRU B appears to be equivalent to <implicitly place paragraph name B-END at the end of B, and paragraph name HERE after the perform clause> ALTER B-END TO PROCEED TO HERE. GOTO A. HERE. ALTER B-END TO PROCEED TO C. (to fix it all up for next time.) it is possible to have BOTH the ranges above alive simultaneousy; it would be legal to have paragraph A contain a PERFORM B THRU D, as long as control flow did not drop thru the end of C during the inner perform. Some of the newer standards may limit this, but the standards and implementations of the late 60's and early 70's (I date myself) appeared to permit it. Did I do it? I simply couldn't bring myself to it, it was TOO horrible. Did I see stuff like that (or worse) used? Repeatedly; and they were proud of how clever they were! Donn Terry HP Ft. Collins Co.