> I think it is invalid, though I have not (yet) checked the standard.
If the previous code is invalid, is the following one also?
program optional
call first(5)
call first(6, c=4)
contains
subroutine first(a,b,c)
integer a
integer, optional :: b,c
call second(a,b=b,c=c)
call second(a,c=c)
call second(a,b=b)
call second(a)
return
end subroutine
subroutine second(a,b,c)
integer a
integer, optional :: b,c
print *, a, present(b), present(c)
return
end subroutine
end program
!from
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/d17f2ecd438fc639/385133c15a599b0d?lnk=gst&q=optional#385133c15a599b0dwhich gives without complaining (even with -fcheck=all):
5 F F
5 F F
5 F F
5 F F
6 F T
6 F T
6 F F
6 F F
Is the difference between invalid and valid onlu due to the use of a pointer?
Dominique
PS I am not planning to use optional arguments whithout checking which
ones are present!