Pointers and memory

A pointer in Fortran is an alias, not a value, and the six lessons here treat it that way. POINTER and TARGET, association and ASSOCIATED, the procedure pointer and the pointer component of a node come first. The part ends on the choice between a pointer and an allocatable, and on what a program owns: deallocation, the leak valgrind finds, and the finaliser that releases a handle.

083 Pointers and TARGET POINTER, TARGET, the association => and a pointer that refers to another variable Open 084 Association, ASSOCIATED and NULLIFY ASSOCIATED, NULLIFY, a pointer to an array section, and a dangling target Open 085 Procedure pointers PROCEDURE(interface), POINTER, a pointer to a module procedure and a dispatch table Open 086 Pointer arrays and linked structures an array of pointers, a node with a pointer component, and a walk that frees as it goes Open 087 Pointer or allocatable what each owns, aliasing, the copy on assignment, and the rule of thumb Open 088 Deallocation, leaks and finalisation DEALLOCATE, automatic deallocation, a leak that valgrind shows, and a finaliser that closes a handle Open

Lessons