From: Joseph M. Newcomer on
FORTRAN-77 made a lot of changes in this direction, and after that I stopped paying
attention to FORTRAN; the only major FORTRAN program I ever maintained was written in
pre-FORTRAN-77. But old FORTRAN programmers still object to the inconvenience of not
having the 3-way IF statement
IF(expression) 10,20,30

which would go to line 10 if expression < 0, line 20 if expression == 0, and line 30 if
expression > 0. This corresponded to a particular machine instruction in the IBM 7090,
which worked as follows (and I won't have the syntax right)
CAS loc
GREATER
EQUAL
LESS

where CAS was the "compare AC with storage" instruction that tested the (one-and-only)
accumulator, and skipped 0 instructions if the AC value was greater than the memory value,
skipped one instruction if the the AC value was equal to the memory value, and skipped 2
instructions if the AC value was less than the memory value. So you got the best code if
you put the negative label as the first label after the IF, e.g.,
IF(expression) 10,20,30
10 ...

Note that the GREATER or EQUAL cases were almost always TRA (transfer) instructions. We
would call them JUMP instructions.

See http://www.frobenius.com/instruction-set.htm for the whole instruction set. Pay
particular attention to such cute instructions as DVH (Divide or Halt) that stopped the
entire multimillion-dollar machine dead in its tracks if there was a divide-by-zero
exception. I don't think I have looked at the 7094 since the early 1970s when I reviewed
it for a history-of-computer-architectures seminar, along with the IBM 7030 ("Stretch"),
which was one of the first supercomputers.
joe


On Sun, 24 Jan 2010 00:21:54 -0800 (PST), Woody <ols6000(a)sbcglobal.net> wrote:

>On Jan 22, 10:32�pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
>> I programmed in FORTRAN. �It is a Really Bad Language, but when you need "global"
>> variables shared with subroutines, you have to put them in COMMON.
>
>This is no longer true. Fortran now has "modules", which can include
>data and subroutines. Also dynamic storage allocation, pointers and
>user-defined data types. And variable names can be longer than 6
>characters! (FORTRAN II, anyone?)
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Hector Santos on
Joseph M. Newcomer wrote:

> FORTRAN-77 made a lot of changes in this direction, and after that I stopped paying
> attention to FORTRAN; the only major FORTRAN program I ever maintained was written in
> pre-FORTRAN-77. But old FORTRAN programmers still object to the inconvenience of not
> having the 3-way IF statement
> IF(expression) 10,20,30
>
> which would go to line 10 if expression < 0, line 20 if expression == 0, and line 30 if
> expression > 0.


This is all based on who YOU worked for. It actually violate some old
Software Engineering "25 lines" guidelines in particular with military
contracts:

Thou should not exceed 25 lines or jump over 25 lines.

and by those days, using GOTO or jumps was definitely the beginning of
being a TABOO. Structured programming was definitely the name of game
by this point - for any language. If a goto or jump was required, the
exception was it must be a short jump, 25 lines was the guideline.

--
HLS
From: Tom Serface on
I don't use goto's much any more, but there have been a few times over the
years when they have been handy. I've never really understood the taboo
thing. I like to focus more on writing code that works and makes sense.
Sometimes a goto is a lot more readable than a ton of nested if statements.

Of course, coming from a FORTRAN background I didn't have the same stigma
with it as some programmers who've only done OOP.

Tom

"Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
news:#YIZgS9oKHA.1892(a)TK2MSFTNGP02.phx.gbl...
> Joseph M. Newcomer wrote:
>
>> FORTRAN-77 made a lot of changes in this direction, and after that I
>> stopped paying
>> attention to FORTRAN; the only major FORTRAN program I ever maintained
>> was written in
>> pre-FORTRAN-77. But old FORTRAN programmers still object to the
>> inconvenience of not
>> having the 3-way IF statement
>> IF(expression) 10,20,30
>>
>> which would go to line 10 if expression < 0, line 20 if expression == 0,
>> and line 30 if
>> expression > 0.
>
>
> This is all based on who YOU worked for. It actually violate some old
> Software Engineering "25 lines" guidelines in particular with military
> contracts:
>
> Thou should not exceed 25 lines or jump over 25 lines.
>
> and by those days, using GOTO or jumps was definitely the beginning of
> being a TABOO. Structured programming was definitely the name of game by
> this point - for any language. If a goto or jump was required, the
> exception was it must be a short jump, 25 lines was the guideline.
>
> --
> HLS

From: Hector Santos on
Same here Tom. I won't limit myself to simpler coding solution but I
won't use it as a first thought. The 25 line guideline was born from
the 25x80 dumb (not smart) terminal days - You had to be able to show
the whole functionality (function) in one display page view. The
theory included the ideas that it was easier to read, maintain and it
help in minimizing bugs. Note again, there were DOD contract
guidelines where single sourcing and code maintenance would be important.

---

Tom Serface wrote:

> I don't use goto's much any more, but there have been a few times over
> the years when they have been handy. I've never really understood the
> taboo thing. I like to focus more on writing code that works and makes
> sense. Sometimes a goto is a lot more readable than a ton of nested if
> statements.
>
> Of course, coming from a FORTRAN background I didn't have the same
> stigma with it as some programmers who've only done OOP.
>
> Tom
>
> "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
> news:#YIZgS9oKHA.1892(a)TK2MSFTNGP02.phx.gbl...
>> Joseph M. Newcomer wrote:
>>
>>> FORTRAN-77 made a lot of changes in this direction, and after that I
>>> stopped paying
>>> attention to FORTRAN; the only major FORTRAN program I ever
>>> maintained was written in
>>> pre-FORTRAN-77. But old FORTRAN programmers still object to the
>>> inconvenience of not
>>> having the 3-way IF statement
>>> IF(expression) 10,20,30
>>>
>>> which would go to line 10 if expression < 0, line 20 if expression ==
>>> 0, and line 30 if
>>> expression > 0.
>>
>>
>> This is all based on who YOU worked for. It actually violate some old
>> Software Engineering "25 lines" guidelines in particular with military
>> contracts:
>>
>> Thou should not exceed 25 lines or jump over 25 lines.
>>
>> and by those days, using GOTO or jumps was definitely the beginning of
>> being a TABOO. Structured programming was definitely the name of game
>> by this point - for any language. If a goto or jump was required, the
>> exception was it must be a short jump, 25 lines was the guideline.
>>
>> --
>> HLS
>



--
HLS