Introduction

FORTRAN, “the infantile disorder”, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is too clumsy, too risky, and too expensive to use.

— Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5 (1982)

FORTRAN, short for “FORmula TRANslation”, was the first high-level programming language and has been in wide-spread usage for decades. The first version was developed under the guidance of John Backus at IBM. Released in 1957 for the IBM 704, the language quickly gained popularity among scientists and engineers.

Punched Card
Fig. 1: An 80-column punched card with Fortran code (source)

Many of the flaws which make Fortran an unloved child today are not part of modern language versions anymore or have been deprecaded a long time ago, like:

The latest Fortran standards 2003 and 2008 are major extensions of the language that make programming much more easy and fun. Modern features like object-oriented programming, inheritance, polymorphism, parallel processing, and interoperability with the C programming language have been added.

This chrestomathy tries to give an introduction to programming in modern Fortran on Unix-like operating systems. The example code has been tested on FreeBSD, using GNU Fortran and/or Flang, but should be partially compatible to other operating systems and compilers as well.

Several books dealing with modern Fortran are available (see fig. 2). The eBook “Introduction to Programming using Fortran 95/2003/2008” by Ed Jorgensen gives a great overview and can be downloaded for free.

Fortran books
Fig. 2: Books about programming in modern Fortran