Affiliate disclosure

Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.

Further Reading: Modernizing Legacy Fortran

Modernization sits at the intersection of two literatures: the Fortran-specific "what does this old construct become?" and the language-agnostic discipline of changing working code safely. Read from both. Sources are tagged Tier 1 (confident, recommended) and Tier 2 (real and worth seeking; confirm the current edition/URL yourself).

The Fortran reference for the "after"

  • Metcalf, Reid, and Cohen, Modern Fortran Explained (Oxford University Press). The definitive account of the modern features you are migrating toward — modules, intent, assumed-shape, error stop, transfer. When you need the exact rule for a replacement, this is the book. Tier 1.
  • Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). Its chapters contrasting the obsolescent features with their modern replacements map almost one-to-one onto this chapter's recipe. Tier 1.

The discipline of changing working code

Tools that do the mechanical steps for you

  • findent. An open-source tool that converts fixed-form to free-form and reindents; it automates the bulk of steps 1–2. Review its diff — automation is reliable but not infallible on continuation lines. Tier 1.
  • fprettify. A configurable Fortran source formatter (whitespace, indentation, keyword case) useful for imposing a consistent modern style across a migrated codebase. Tier 1.
  • plusFORT (Polyhedron) and CamFort (a Cambridge/Kent research tool). Heavier machinery that can restructure GOTOs and analyze/units-check old code. Worth knowing exist when a migration is large enough to justify them. Tier 2.

Free and online

  • fortran-lang.org — learning and "quickstart" material. The community hub's guidance on modern style is the reference implementation of the conventions this book teaches; its blog and Discourse carry practical modernization discussions. Tier 1.
  • The GCC / gfortran documentation. Read the pages on -std=legacy (to build the "before") and -std=f2018 with -Wall and -fcheck=all (to build and check the "after"). The list of obsolescent and deleted features tells you what a modern compiler will and will not still accept. Tier 1.

Primary source

  • ISO/IEC 1539-1:2018 (the Fortran 2018 standard). The final authority on what each modern construct means and on which older features are "obsolescent" versus "deleted." You will rarely read it cover to cover, but it settles arguments. Tier 1.

Suggested order

  1. Skim the obsolescent-features section of the gfortran docs or Chapman — it is the mirror image of this chapter's recipe and orients you to what needs replacing.
  2. Read the first three chapters of Feathers for the safety mindset (reference-first, one change at a time) before you touch a real code.
  3. Keep Metcalf/Reid/Cohen at hand for the exact modern syntax of each replacement as you work.
  4. Try findent on a small fixed-form file to see steps 1–2 done automatically — then read the diff, so you learn what the tool did and where it might not have.