[J3] DIM arguments
Bill Long
longb at cray.com
Wed Mar 6 18:21:07 EST 2019
For this example:
subroutine boo(a,i)
logical,intent(in) :: a(10,10)
integer,optional :: i
if (present(i)) then
print *, any(a,i)
else
print *, any(a)
end if
end
F08 gave an error because there was a specific requirement in the (then) optional DIM argument:
""The corresponding actual argument shall not be an optional dummy argument.”
In F2018 we changed the DIM argument to be not optional. But we also deleted the restriction sentence. Was that intentional? It seems that (according to the logic in interp F08/0038) that we did not want to allow optional arguments to correspond to the DIM argument of the ANY function. But the restrictions on the use of optional arguments alone (absent the specific prohibition for the DIM argument of ANY) appear to make the above code conforming. Or maybe the prohibition is stated elsewhere for these DIM arguments, and I’m not seeing it.
Cheers,
Bill
Bill Long longb at cray.com
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list