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: Procedures
Where to go deeper on subroutines, functions, intent, pure/elemental, and array arguments. Sources are
tagged Tier 1 (works we are confident exist and recommend) and Tier 2 (real and useful, but confirm
the current edition or URL yourself). Procedures are the backbone of every later chapter, so time spent here
compounds.
The teaching texts
- Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). Its procedure chapters are the
gentlest thorough treatment of subroutines, functions, argument passing, and
intent, with many worked scientific examples in the same spirit as ours. Start here if any section felt fast. Tier 1. - Milan Curcic, Modern Fortran: Building Efficient Parallel Applications (Manning). Especially good on
why
pureandelementalmatter — it connects them directly to the parallelism of later chapters, exactly the argument we make in §6.4. Project-driven and modern throughout. Tier 1.
The reference
- Metcalf, Reid, and Cohen, Modern Fortran Explained (Oxford University Press). The definitive account
of the rules this chapter sketches: the precise semantics of
intent, the constraints onpureandelementalprocedures, argument association, and the three array-argument forms. When you need to know exactly what the standard permits, this is the book. Tier 1. - The Fortran 2018 standard (ISO/IEC 1539-1:2018). The final authority. Its clauses on procedures, dummy-argument intents, and pure/elemental requirements are dense but unambiguous — worth consulting once you hit a genuine corner case a compiler and a textbook disagree on. Tier 1.
Free and online
fortran-lang.org— the learning resources and "Quickstart tutorial." The sections on procedures and modules cover the same ground as this chapter with runnable snippets, and the material is actively maintained by the modern-Fortran community. The single best free starting point. Tier 1.- The GCC /
gfortrandocumentation. Consult it for compiler-specific behavior — howgfortranreports anintentviolation, its treatment of the Fortran 2018 "recursive by default" rule, and the diagnostics-Walland-fcheck=allproduce for procedure calls. Tier 1. - The Fortran Wiki (
fortranwiki.org). Short, focused articles onpure,elemental, keyword and optional arguments, and assumed-shape arrays — handy for a quick refresher on one feature. Community-edited, so cross-check anything surprising. Tier 2.
Tools
- Compiler Explorer (
godbolt.org), withgfortranselected. Paste anelementalfunction applied to an array, or apurefunction called twice in a loop, and watch the compiler hoist and vectorize it. This is the most vivid way to see the optimization payoff §6.4 describes — bookmark it for Chapter 27, where it becomes central. Tier 1.
Suggested order
- If any section felt quick, read Chapman's procedure chapters first — they move slowly and repeat the fundamentals with fresh examples.
- Skim the
fortran-lang.orgprocedures tutorial and type its snippets; ten minutes of compiling beats an hour of reading here. - When a specific rule bites — "can an
elementalfunction have an optional argument?", "what exactly doesintent(out)do to an allocatable component?" — reach for Metcalf, Reid, and Cohen, then confirm the compiler's take in the gfortran docs. - Once you have written a few procedures, open
godbolt.organd compare the assembly of apurefunction against an identical non-pureone. You will not follow every instruction yet, but you will see that the keyword changed the output — the promise §6.4 makes, made concrete.