Skip to content

STY011 mixed-scalar-array-declaration ​

warning opt-in

One declaration statement declares both scalars and arrays.

Why ​

real :: x, y(3) hides the array among scalars: the shape is easy to miss when reading the declaration list. Declare arrays and scalars in separate statements.

Reported ​

fortran
real :: x, y(3)

Preferred ​

fortran
real :: x
real :: y(3)

Suppressing ​

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

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

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

Equivalent ​

Fortitude rule S262 (see Lint Rules).