[TUHS] origin of string.h and ctype.h

Warner Losh imp at bsdimp.com
Mon Aug 14 03:24:02 AEST 2017


On Sat, Aug 12, 2017 at 11:43 PM, Dave Horsfall <dave at horsfall.org> wrote:

> On Sat, 12 Aug 2017, Steve Johnson wrote:
>
> A little Googling shows that the IF I mentioned was called the "arithmetic
>> IF".
>>
>
> Ah yes.  It was in FORTRAN II, as I recall.


Yes. It originated there.

 There was also a Computed GOTO that branched to one of N labels
>> depending on the value of the expression.
>>
>
> I think that was still in FORTRAN IV?


It was still in Fortran 77.

N=3
goto (10, 20, 30, 40, 50), N

would goto label 30.

 And an Assigned GOTO whose main use, as I remember, was to allow for error
>> recovery when a subroutine failed...
>>
>
> A real ugly statement; you assigned a statement number to a variable, then
> did a sort of indirect GOTO (or did the compiler recognise "GOTO I")?
>
> How those poor devils ever debugged their code with such monstrous
> constructions I'll never know.


assign 10 to N
....
goto N

would goto the label 10 in your fortran program. Label 10 must be in the
same compilation unit, and can't be in the middle of a block.

You could make this one better by giving a list of possible statements. I
saw it used effectively when one of N sub formulas was needed later in a
computation in some code doing a complex computations that used it to avoid
division by zero and also optimize the terms used in part of the
calculation. I've also seen it in some truly horrific code too terrible to
relate. But it was relatively rare in the FORTRAN code I dealt with back in
the day...

What made it not totally horrific was that N had to be assigned a label
that was in the functional unit (so it wasn't arbitrary).

If you'd seen some of the spaghetti FORTRAN code I have, you'd know that
these weren't the worst offenders for making things unreadable nightmares,
though they didn't help.

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170813/0a21e94b/attachment.html>


More information about the TUHS mailing list