Re: Help for a FORTRAN N00b



e p chandler <epc8@xxxxxxxx> wrote:

OK. The original code is completely illegal.

1. Where did this idiom come from?
[GOTO the continue statement of a DO loop from outside the loop counting
as a jump around the loop]

As I mentioned before, some compilers implemented that. I couldn't say
whether it was an intentional feature or just how things happened to
work out in conjunction with failure to diagnose the condition.

I guess it made sense to someone. Not to me. You have to have a bunch of
special-case exceptions to define it at all. (For example, don't even
think of what it might mean if the terminal statement is anything other
than a CONTINUE - so you have to special-case it as applying only to
CONTINUE). I even recall a vendor rep (from SGI) vociferously arguing
here that the standard specified that. Turns out that he was using his
own guess as to what the range of a DO loop meant rather than anything
from the standard. That was long ago, but it stuck in my mind, partly
because I wondered how the vendor could have gotten a basic definition
so badly wrong and still gotten the compiler to work on much of anything
at all, even on legal codes. I suppose that the rep in question wasn't
the person who implemented the stuff.

2. Who wrote the compiler that actually compiled it to running code?

I forget, but I've definitely seen code do that. I'm thinking it might
have been from a DEC compiler, just because one code that I recall
fixing came from someone who regularly used DEC machines. But that's
just a guess.

Hmm. Since I recall an SGI rep arguing that this was standard, that
probably means there was once an SGI compiler that did it.

3. I thought that inverting a matrix was a "bad idea" anyway. (Yes APL
does have it.)

Often. Not always. It is usually considered a "bad idea" if the
objective is to solve a linear system. But there are cases where the
inverse is actually what is wanted. One example I know of is the Cramer
Rao bound (an estimate of the error covariance). In any case, that's a
question about numerical methods rather than Fortran; I'll not further
pursue that at the moment.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... >> both less efficient and less safe than the Fortran and Basic standard. ... >> The C for loop is actually trying to do what a do loop does. ... sloppy thinking that results from confusing a programming language ... > I do not believe that you are capable of writing a conforming C compiler. ...
    (comp.programming)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... it's a for loop in the C sense. ... > sloppy thinking that results from confusing a programming language ... >> I do not believe that you are capable of writing a conforming C compiler. ... Does Microsoft's C compiler perform this optimisation? ...
    (comp.programming)
  • Re: first book published on Fortran?
    ... For variables, the compiler doesn't know. ... That depends on the language and its standard. ... > manual seems to imply that the test is done at the end of the loop. ...
    (comp.lang.fortran)
  • Re: Histogram of character frequencies
    ... generated object code may simply be a loop in which elements are ... believe any C compiler anywhere would reject it. ... On the first iteration of the loop you test the end of file indicator ...
    (comp.lang.c)
  • Re: DO-loop index variables
    ... >> for a compiler to not do it. ... >> that the standard requires that something not be so. ... My own opinion is that the designers of f66 wanted to leave it up to the ... by testing count at the bottom of the loop was already well established. ...
    (comp.lang.fortran)