Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In my Programming Language Concepts class it was mentioned in passing that Fortran's original control structures were insufficient. It was alluded that they were too similar to machine instructions for the IBM 704. Was this the case? What exactly made them insufficient?

share|improve this question
    
FORTRAN's arithmetic IF was essentially an optimization of the IBM 704's skip operation. –  Yannis Rizos May 22 '12 at 6:35

2 Answers 2

up vote 10 down vote accepted

Well let's see early versions of Fortran had IF GOTO and DO.

There were several variations on IF and GOTO including ASSIGNED GOTOs and computed GOTO which was sort of like a CASE statement.

So apart from the DO loops all the control statements were variations on IF and GOTO involving hard coded statement numbers. The result was more vermicelli than spaghetti.

The DO loop itself was problematic in that it was strictly "do until" with the test at the bottom of the loop, so there was no way to skip the first iteration other than preceding it with yet another "IF (cond) GOTO 9999".

So as most control structures were "GOTO linenumber" any substantial change to the code would involve lots error prone changes to the target line numbers.

The DO loop needed to be supplemented with a GOTO to turn it into a DO WHILE.

The earliest Fotrans had a "GOTO" of the form.

IF (VAR) 100,200,300

Which meant if VAR is <0 then go to statement 100. If = 0 then statement 200, if > 0 then statement 300.

On the whole it was not too bad an attempt. The fact that you could write formulas that looked similar to what you professor wrote on the blackboard was the killer feature of FORTRAN, the program flow had to wait a few years to catch up.

share|improve this answer

The bad thing about FORTRAN IV was that all control "structures" (including loops) depended on labels. So they provided unstructured control. They were too powerful. How about, for example branching into a label inside a loop and then, later, branching out again ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.