Skip to content

MDN011 old-style-array-constructor ​

warning enabled by default

An array constructor written (/ ... /) instead of [ ... ].

Why ​

The square-bracket form has been standard since Fortran 2003; it is shorter and does not look like a division. Fixable automatically (fobis lint --fix).

Reported ​

fortran
a = (/ 1, 2, 3 /)

Preferred ​

fortran
a = [1, 2, 3]

Suppressing ​

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

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

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

Equivalent ​

Fortitude rule MOD011 (see Lint Rules).