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

Fortran, the “FORmula TRANslator”, is the first high-level programming language and has been in wide-spreed 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

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 current Fortran standards 2003 and 2008 added support for modern features like object-oriented programming, inheritance, polymorphism, parallel processing, and interoperability with the C programming language.

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 compatible to other Unix-like 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: Several books about programming in modern Fortran have been published