Re: [OT] Commodore 64 BASIC (was: Interesting bug)

From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 04/22/04


Date: 22 Apr 2004 13:12:49 GMT

In <c681oo$qbq$2@oravannahka.helsinki.fi> Joona I Palaste <palaste@cc.helsinki.fi> writes:

>I have never programmed in Fortran, but I think it was about the same
>situation with the Fortran version Dan Pop grew up with.

Nope, FORTRAN IV was much better than BASIC and the "new" logical IF
statements were a great improvement over FORTRAN II's arithmetic IF
statements (which were gotos with 3 destinations).

Each program unit (main unit, functions and subroutines) had its own
local variables and it could be made to "see" only the global variables
it needed to see.

Its main drawbacks, that survived until F90, were the fixed-form line
format with purely numeric labels (characters beyond column 72 were
silently ignored, to provide additional fun during debugging) and blanks
being *completely* ignored in the statement field (starting in column 7),
except inside "string" literals. Hence the (in)famous typo:

        DO 5 I = 1. 5

(the period was supposed to be a comma) that led to the statement being
parsed as:

        DO5I = 1.5

i.e. a loop was replaced by an assignment to a bogus variable and the body
of the loop was executed once instead of 5 times. This happened in a NASA
program, but the consequences were minimal (a certain entity was evaluated
with less precision than intended).

Dan

-- 
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de


Relevant Pages

  • Re: [OT] Commodore 64 BASIC (was: Interesting bug)
    ... >>situation with the Fortran version Dan Pop grew up with. ... > of the loop was executed once instead of 5 times. ... This is a classic bug story, about which a great deal of ...
    (comp.lang.c)
  • Re: [OT] convert C code to Fortran
    ... >providing interfaces, creating the right headers and intelligent ... The real problem is that the solution is not portable. ... interfacing C and Fortran are highly system specific. ... Dan Pop ...
    (comp.lang.c)
  • Re: Interesting bug
    ... Dan Pop scribbled the following: ... My first programming language was FORTRAN II, ... >>which would probably have driven me to another field of endeavor ...
    (comp.lang.c)
  • Re: [OT] - propagation of incorrect information
    ... >If you spell FORTRAN as Ratfor. ... Dan Pop ...
    (comp.lang.c)
  • Re: About alternatives to Matlab
    ... But whether a single loop is faster than several BLAS calls does not ... Bad Fortran 95 can easily be 25% lower than well-tuned C99. ... NumPy can be slower than equivalent C by an order of magnitude. ... manipulated within Python, not the speed of python code using NumPy ...
    (comp.lang.python)

Loading