Skip to content

MDN031 include-statement ​

warning opt-in

A Fortran include line.

Why ​

include pastes text: the included declarations are compiled again in every includer, and nothing checks they stay consistent. A module provides the same entities once, with explicit interfaces.

Reported ​

fortran
include 'constants.inc'

Preferred ​

fortran
use constants, only: pi

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[MDN031] <why this occurrence is fine>

For the whole project, ignore = MDN031 in the fobos [lint] section.

Equivalent ​

Fortitude rule MOD031 (see Lint Rules).