Hacker News new | past | comments | ask | show | jobs | submit login

Fortran-10 is old school, not Fortran-77.

https://github.com/DigitalMars/Empire-for-PDP-10

Fortran-77 is for young whippersnappers.




In the early 2000's I worked on some Fortran-77 code that we were parallelizing (As a babe, this was my first experience with Fortran-77). We were having strange bugs because it seemed like some MPI calls were just not happening and others were. There were no compiler errors or warnings. Everything was supposedly fine. However, certain properties were propagating across grid elements just fine and others weren't. e.g. A particle might cross a vertical boundary and be just fine in the next CPU's element, but if it crossed a horizontal boundary it would lose it's horizontal momentum but keep everything else.

Eventually we figured out that the lines that weren't working were just over 80 characters long and the ones that were working were under 80 characters long. The compiler we were using was adhering to the Fortran-77 spec of a maximum of 80 characters per line (because that's what would fit on a punch-card), but it was just ripping those lines out and ignoring them without raising any kind of warning. If a line of code was over 80 characters long, it was just silently ignored. All we had to do was split the lines over 80 characters up and that particular bug was squished.

In my humble opinion, if a language can trip you up because of how many characters fit on a punch-card, it qualifies as "old school".


If you were using Hollerith punch cards, like you were supposed to, you couldn't have had that problem.


That column of GOTOs in EMPIRE.FOR. That is the stuff of nightmares.

EDIT- Terrifying:

251 GOTO (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37) I-20


It's basically a switch statement, but without the benefit of descriptive case identifiers. So it's basically,

  switch (I-20) {
  case 21:
  case 22:
    ...
  }
but you have to imagine "21" as the string identifier, not the integer value. `I-20` is indexing the list of labels in the GOTO statement.

The earlier column beginning with

  GOTO (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) I
is easier to read

  switch (I) {
  case 1:
     ...
  case 2:
     ...
  }
because the integer value of I, the string labels, and their index in the list are all the same.

I've never written Fortran. I did learn to program using TI-85 BASIC, though, and am well versed in C. The GOTO in the Fortran code is possibly the easiest part for me to understand.


Shockingly Bad use of line numbers.

the convention I used was taught was always 4 digits always increasing going down the pages.

7000 and 8000 range where for input and output FORMAT statements, 6000 was used to label code 6999 was always the exit


If you look at the code, they seem to follow a similar convention. But the computed GOTO described above is using a set of labels employed for what looks like an inner state machine, related to a previous inner state machine (thus the offset by 20). It seems perfectly reasonable (preferable, even) to use an entirely different domain of numeric labels, distinguished by length, for those parts of the code.


> Shockingly Bad

<hangs head in shame>


My only question is: Which century is Empire "the game of"?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: