Optional argument not declared last

This is a FORTRAN-only style warning indicating that an optional dummy argument was declared before a non-optional argument.

This usage is discouraged because it forces the caller to explicitly use the argument's name at each call.

ID

Observation

Description

1

Definition

The definition of the formal parameters

Example

          
subroutine mysub(i,j)
! optional argument "i" is before nonoptional argument "j"
integer, optional :: i
integer :: j
if (present(i)) print *,i
print *,j
end

integer :: k
interface
    subroutine mysub(i, j)
    integer, optional :: i
    integer :: j
    end subroutine mysub
end interface
read *,k
call mysub(k, k)
call mysub(j=k)
end
        

Copyright © 2010, Intel Corporation. All rights reserved.