176. Because recursive I/O is prohibited, a function should use ERROR STOP msg instead of PRINT statements for error messages.#

topic: Input and Output

Note

This tip is a draft1.

Because recursive I/O is prohibited, a function should not have PRINT or WRITE(*,fmt) statements for error messages, since the behavior of

print*,f(x)

is then undefined. ERROR STOP <msg> is an alternative. Internal write can be useful in a function.



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.