- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
COMPLEX *8 FRIST : I give the spellmaster credit for not using all caps as would have been originally used by the punchcards.
Admin
so wtf is frotran program not written in caps?
Admin
Grr.
The whole point of FORTRAN is that is is written in all caps.
If you start writing FORTRAN in lowercase (or worse, CamelCase and/or its variants), there will be wars and rumours of wars, nation shall rise against nation, and kingdom against kingdom: and there shall be earthquakes in divers places, and there shall be famines and troubles: these are the beginnings of sorrows.
I leave it as an exercise for the student to determine why it would ever be necessary and/or desirable to create such an array in the first place. The Lord moveth in a mysterious way his wonders to perform.
Admin
That's what liches do... producing tons of dead code.
Admin
You want to write a number padded to three chars. You don't want to do all the weird arithmetic each time, so you just grab c(x). Never mind the 900 or so values that don't get used.
Admin
Today FORTRAN is written Fortran ...
Admin
Blasphemy.
Admin
f0rTRaN?
:P
Admin
FrisTran?
Admin
My first project in the early 80's was writing a recursive descent parser for a programming language in Fortran. Boggles the mind that this was even possible.
Admin
I can't be the first one...well, maybe I can.
You should know by now, that a Real Programmer can do anything in FORTRAN: https://en.wikipedia.org/wiki/Real_Programmers_Don%27t_Use_Pascal
Admin
"Most of the people using Fortran, it seems, learned it in the 70s. And no matter what happens to the language, they still write code like it’s the 70s." And continue to write FORTRAN code when they use C# or Java.
Admin
Not all that long ago I was trying to fix a bug in the NOAA public-domain weather prediction code. About 630,000 lines of old FORTRAN. I found the problem-- about 15 places in the code they computed how many bits it would take to represent the wind speed, something like this:
Try running this on a few test cases. On most computers it gives the wrong answer a unacceptable amount of the time. In a few of the places they tried to fix this by adding a little arbitrary fudge-factor:
... which is not totally bad, it just creates more errors, on the overestimation side.
Admin
Fortran is still used partly because of the installed base and partly because 50 years of compiler optimization makes it fast. Meanwhile, my personal "favorite" bit of legacy code, still in use in 2015 at BigOverwhelminglyBigDefenseContractor, Inc, called a Fortran-library random number generator which had been shown in 1966 to be rather less than random (obvious patterns arose). So much for previous engineers either learning what's new or running code reviews.
Admin
character*3 :: c(999) do 1 i = 1, 999 write(c(i), '(i3.3)') i 1 continue print '(a3)', c end
Admin
Real programmers can write FORTRAN programs in any language.
Admin
Edsger Dijkstra, 1975: How do we tell truths that might hurt?
In the good old days physicists repeated each other's experiments, just to be sure. Today they stick to FORTRAN, so that they can share each other's programs, bugs included.
Admin
I've seen a research lab use a homegrown payroll system written entirely in FORTRAN back in the 1970's. A text database package I used a few years later was also entirely written in FORTRAN. Both worked but I'm still not convinced that FORTRAN was the best choice. Probably two cases of "if the only tool you have is a hammer ..."
Admin
If you think the Bobby Tables joke is funny enough to set as your username, you're too wannabe hipster to comment on languages from the '60s and '70s.
Admin
More fun with Fortran arrays. Many moons ago in grad school I got to work with an even more ancient bit of quantum chemistry code. IIRC, it was probably F77 spec, but don't hold me to that. QC codes even today bring supercomputers to their knees, so back in the day you needed every bit of memory available to run your code. But dynamically sized arrays don't exist in F77, so how can you develop code to run on many different machines with different amounts of memory?
Simple: you use a array. Or rather, the A() array.
Simply modify the initial command DIMENSION A(Size of memory of your machine) The array A will be your only data variable in the entire program. Want a variable to store a value? All you need to know is the index of A that holds it. 1-d array? Just create it by noting the start index and size. 2d? A bit trickier, but start index, n 1-d arrays of m size and you're golden. The generalization to 3 and 4-d arrays is left as an exercise to the reader.
I was very, very glad that the code was fast, well debugged by the authors and I only needed it as an external library.
Admin
More fun with Fortran arrays. Many moons ago in grad school I got to work with an even more ancient bit of quantum chemistry code. IIRC, it was probably F77 spec, but don't hold me to that. QC codes even today bring supercomputers to their knees, so back in the day you needed every bit of memory available to run your code. But dynamically sized arrays don't exist in F77, so how can you develop code to run on many different machines with different amounts of memory?
Simple: you use a array. Or rather, the A() array.
Simply modify the initial command DIMENSION A(Size of memory of your machine) The array A will be your only data variable in the entire program. Want a variable to store a value? All you need to know is the index of A that holds it. 1-d array? Just create it by noting the start index and size. 2d? A bit trickier, but start index, n 1-d arrays of m size and you're golden. The generalization to 3 and 4-d arrays is left as an exercise to the reader.
I was very, very glad that the code was fast, well debugged by the authors and I only needed it as an external library.
Admin
Fortran now is very stylish with more power for scientific programming. It is still the best language for scientific programming... However,unfortunately, many persons who have learned an old standard of the language are still using that standard. ..The language has changed considerably... The latest versions are fortran 95, fortran 2003, and fortran 2008....They have everything for everyone in scientific programming...Right now fortran is the best language for parallel programming...and amazingly, fortran is still needed in the world for numerically intensive stuff.
Admin
Hollerith. That's all I'm going to say right now.
Admin
When you declare an array in FORTRAN, e.g...
character*1 b(9)
...the index starts at one (1), by default. If you want 10 elements starting with zero (0), it would be...
character*1 b(0:9)
As given in the article, then, "b(0)" doesn't exist and would likely (hopefully) throw an error.
Admin
I am a FORTRAN programmer from way back. There was a million line program that calculated the cost of cardboard boxes. You know that didn't get rewritten.
Admin
Are you in a position to be able to enlighten us on whether you have identified the person who appears to have relieved himself into today's portion of your preferred breakfast cereal?
Admin
Every time you attempt to write FORTRAN in lowercase , the unholy child weeps the blood of virgins, and Russian hackers pwn your app. Writing FORTRAN in lowercase summons tainted souls into the realm of the living. FORTRAN and lowercase go together like love, marriage, and ritual infanticide. The force of FORTRAN and lowercase together in the same conceptual space will destroy your mind like so much watery putty. If you write Fortran program with lowercase you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes.
Admin
RANDU?
Admin
And SQL is written Sequel. By Microsoft and IBM, sorry, Ibm.
Admin
Comment held for moderation.
Admin
That depends very much on which field of science you're talking about. FORTRAN programmers like to pretend that things aren't Science if FORTRAN programs aren't useful for working with them, but they're very much in their own world.
Admin
I learned FORTRAN (with batch processing on punch cards) as my first programming language, in 1972. But I've learned more since then. By the time FORTRAN 77 came out, I already knew there were better languages for any purpose but screamingly fast computation - and that you could write any program in a wide variety of languages, but some (like FORTRAN and COBOL) would require much more work than others.
But for me, the real WTF was when I went back to college for an Electrical Engineering degree in 1981 - and had to use FORTRAN 77, on punch cards. The purpose of this exercise turned out to be that, in an era when c dominated both systems programming and embedded programming, the Professional Engineering examination's programming section was in FORTRAN 77.
About payroll systems and other databases written in FORTRAN: My understanding is that IBM once used FORTRAN for just about everything that didn't have to be written in assembly language. COBOL was the creation of heretics who didn't rely on IBM for 100% of their computer needs, and the other languages out there were either the creation of egghead professors that couldn't be compiled (Algol), were impractical for large programs (Lisp), or looked pretty much like re-branded FORTRAN (PL/I). There were simplified database programming interfaces (RPG = "Report Generating Language) even before these were called "databases", but the underlying code was likely to be FORTRAN. So if I see FORTRAN used where it's obviously inappropriate, I'll think of it as very old code that has been updated rather than rewritten, again and again.
.
Admin
Oh come on! I write everything in lowercase, fortran included. :-P
I like the fact that it has application binary interface compatibility. I don't necessarily have to worry about which compiler compiled it - I can call the library. Same with C in all cases that I've encountered. Not so for C++, where I've gotten weird bugs because my company updated visual studio.
Admin
EMAIL was written in FORTRAN.
No, I'm not going to link to the website of a self-aggrandizing wanker, who's currently trying his hand at politics, after failing to convince the world that he's the "Inventor of EMAIL". (which he wrote when he was 14, in FORTRAN, in New Jersey)
Admin
Ah, I remember that QM code... for what it's worth, if I recall correctly it used EQUIVALENCE statements internally to make handling the pieces of A a little more manageable.
Admin
Don't worry, Fortran is still alive and well in 2020. And contains plenty of unnecessarily complex constructs, often owing to the need to support outdated compilers, because upgrading the compiler would mean upgrading some-million-dollars in hardware for some customers.
Admin
Most of the WTFs I am seeing with Fortran come from the unwillingness of the language design itself though. There's the general mindset "if it isn't useful for computations, we don't need that feature in the standard."
Case in point: Variable format expressions (https://gcc.gnu.org/onlinedocs/gfortran/Variable-FORMAT-expressions.html). Incredibly useful to make code more concise, but "not needed, because that other, very verbose solution is more powerful".
The mindset of the language development ignores, that all computation code will be embraced by a large amount of infrastructure code for managing memory, resources, files, debug messages, log messages, ... Among other things, something like type-safe variable-size collections would be incredibly useful there or, for that matter, proper strings as opposed to "space padded character matrices". I cringe at CHARACTER(256), POINTER :: MESSAGES(15).
As far as I've seen, there are also no common widely used libraries like glibc for C to fill such gaps, and none of the Fortran codebases I've worked with tries to roll their own either. Which would be a WTF in itself, but less so.