(j3.2006) More on yesterday's specification expression question

Van Snyder Van.Snyder
Wed Jun 19 17:00:20 EDT 2013


Yesterday, I observed that in

  function F ( A )
    integer, intent(in), optional :: A
    integer :: F(merge(3,2,present(a)))
    if ( present(a)) then
      f = (/ 1, 2, a /)
    else
      f = (/ 1, 2 /)
    end if
  end function F

the processors I use don't allow "present" in the bounds specification
for F.  Oddly, they do allow

  integer function G ( A, B )
    character(*), intent(in) :: A
    character(len(a)), intent(in), optional :: B
    integer :: C(len(b))
    G = size(c)
  end function G

There's no problem here, but it's a head-scratcher that processors would
allow G but complain about F.





More information about the J3 mailing list