News for hackers. Stuff that matters.
Re:Show HN: A Fortran web framework by hughw on Monday June 20, 2016 @01:22PM (#11939484)
Change the loop counter? That's supposed to be impossible in Fortran, isn't it? Maybe that's a language extension?
Re:Show HN: A Fortran web framework by theophrastus on Monday June 20, 2016 @01:34PM (#11939579)
This was from code originally from about 1978ish, which compiled on a Microsoft Fortran compiler from the 2000s. It looked something like (without indents):

    DO I=1,10000
      ...
      IF (QQQ .LT. RIX70) THEN
         CALL IXNARF( I, J, R1, R7, XL23 )
         GOTO 23
         ...
      END IF
      111 CONTINUE  
    ...
    END
IXNARF could change 'I' (because Fortran 77 passed arguments by reference not value) and sometime after line (er... "card") 23 it might jump back into the loop at 111.

oh and there was like three comments in the whole several thousand lines, including my favorite at the top of one of the main loops:

    C  CHUGGA CHUGGA CHUGGA
Re:Show HN: A Fortran web framework by sevenless on Monday June 20, 2016 @02:58PM (#11940372)
I remember you could change the value of 3 in Fortran 77.

Then there was the proposal for a Fortran COME FROM statement.

http://www.fortran.com/fortran/come_from.html

Re:Show HN: A Fortran web framework by semi-extrinsic on Monday June 20, 2016 @04:05PM (#11941031)
I believe Intercal implements the COME FROM statement.
Re:Show HN: A Fortran web framework by sun_n_surf on Tuesday June 21, 2016 @06:20AM (#11944722)
`C CHUGGA CHUGGA CHUGGA`

I laughed way harder at this that it warranted.

Re:Show HN: A Fortran web framework by sampo on Monday June 20, 2016 @01:53PM (#11939750)
> Change the loop counter? That's supposed to be impossible in Fortran, isn't it?

It is impossible inside the loop, even in F77.

But if a global variable is used as a loop counter, and the variable is altered in a subroutine, then the code altering the variable is not inside the loop. At least not in the eyes of the Fortran compiler.

    $ cat test.f08

    program test
        integer i
        do i = 1,3
            call sub
            print *,i
        end do
    contains
        subroutine sub
            i = 3
        end subroutine sub
    end program test

    $ gfortran --std=f2008 test.f08 
    $ ./a.out 
           3
Re:Show HN: A Fortran web framework by greglindahl on Monday June 20, 2016 @04:01PM (#11940988)
... just because it does that in gfortran doesn't mean it's standard-conforming code.
Re:Show HN: A Fortran web framework by ams6110 on Tuesday June 21, 2016 @12:49AM (#11943565)
What is the "standard" fortran compiler for scientific computing? Do a lot of people use gfortran? Or something commercial?
Re:Show HN: A Fortran web framework by greglindahl on Tuesday June 21, 2016 @01:25AM (#11943672)
There is no "standard" compiler. There is a Fortran standard, and there are standard-conforming compilers and standard-conforming programs.

There are popular compilers, like gfortran and the Intel compiler.

My point had nothing to do with popularity. My point is that non-standard-conforming programs can have anything happen when they execute, including starting World War III (see https://www.google.com/search?q=fortran+"start+world+war"), and showing output from one compiler doesn't prove anything.

Re:Show HN: A Fortran web framework by sampo on Tuesday June 21, 2016 @12:53PM (#11947166)
> What is the "standard" fortran compiler for scientific computing?

Not so long ago, supercomputers typically had Portland Group, Cray and Pathscale compilers installed. Nowadays it's pretty much Intel and gfortran.