074. Avoid implicit save#

topic: Procedures

Note

This tip is a draft1.

A variable given a value in the declaration has the implicit SAVE attribute and is not re-initialized in later calls to the procedure. Write

integer :: i i = 0

instead of

integer :: i = 0

If SAVE is intended be explicit:

integer, save :: i = 0



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.