Fortran for C Programmers

23 todsacerdoti 15 5/17/2025, 11:41:54 PM flang.llvm.org ↗

Comments (15)

Extigy · 2h ago
One of my favourite features of Fortran is in its array implementation. You can index arrays however you like.

Do you like your initial value to be at index 1? Cool. Prefer to index arrays from 0 instead? Sure, go ahead.

How about an array with indexing symmetric around zero?

    double precision :: arr(-100:100)
Beautiful!
timonoko · 1h ago
CONTINUE - card was eternal mystery. Why cant you have just empty card with line number on it?
SoftTalker · 7h ago
Still used in scientific computing. Perhaps also in some financial settings? Otherwise it’s pretty dead.
pjmlp · 3h ago
That narrow minded approach is one of the reasons OpenCL lost to CUDA, by not taking Fortran support seriously.

I was on a OpenCL Webminar panel, where Khronos folks said exactly the same thing.

Meanwhile, NVidia's investment into PGI compilers really paid itself out.

johnisgood · 3h ago
Real programmers use Fortran! (Reference to that old saying.)

I do not think Fortran is dead though.

almostgotcaught · 6h ago
It's always the people that are chronically online here that comment with most lowbrow stuff. Yes Fortran is so dead that NVIDIA and Intel are both building new compilers for it

https://www.intel.com/content/www/us/en/developer/articles/r...

https://developer.nvidia.com/cuda-fortran

https://flang.llvm.org/docs/

pjmlp · 3h ago
As I point out in a sibling comment, it was definitely one of the reasons OpenCL lost, not being able to dump Fortran HPC workloads into GPUs.
xeonmc · 5h ago
To be fair, in frontendland a framework is considered dead if it hasn’t updated for more than two weeks.
90s_dev · 7h ago
I hate to be superficial, but languages without braces just feel weird to me. I can use them and have even for a paycheck, but... no thanks. Even Lua, one of my favorite languages (if not #1), always feels at least slightly weird when I use it because of do/end.
emmelaich · 7h ago
jmclnx · 8h ago
Very nice, my first professional job was with Fortran IV, but my 19 year old self made lots of mistakes back then :)

Anyway I eventually ended up with c. Recently I started playing with gfortran, but so much have leaked out of me I have been having a tough time of it. I expect this will help me a lot!

Edit: No functions ? OK, noticed it is handled under Subprograms. Seems there have been many changes.

readthenotes1 · 9h ago
I haven't used a modern Fortran, but for older versions , the biggest surprise was the lack of reentrance.
johnisgood · 2h ago
adrian_b · 5h ago
Indeed, reentrance and recursivity and the use of stacks and/or heaps for dynamic memory allocation have appeared in programming languages that have descendants still used today only in 1960, in ALGOL 60 and LISP I. These features have become ubiquitous in the later programming languages, all of which have been at least partially inspired by ALGOL or LISP.

Fortran is the only surviving programming language older than that (first specification in 1954 and first implementation in 1956). Cobol is the only surviving programming language equally old with LISP and ALGOL, so that it has not been influenced by either of them. Thus now Fortran and Cobol are the only surviving programming languages from the era when only static memory allocation was used in programs, though their later versions have added most modern programming language features.

pjmlp · 3h ago
Depending on where you place them, there are still some folks having to deal with NEWP, PL/I and RPG, which are of similar vintage.