> Hi,
>
> A quick question...
>
> When an array is passed to a subroutine or function as an assumed shape
> array, do the references for each dimension of the dummy array begin at 1.
> Is this a portable assumption??
>
Yes, it's portable. The standard requires it. It surprises pretty
much everyone the first time the feature is applied to them. But,
it's the only reasonable thing to do. Suppose your call were
call A(main_array(2:8:4, 5:1:-3))
or even
call A(main_array(-1:8,1:5) + main_array(8:-1:-1,5:1:-1))
there's no natural lower bound.
Dick Hendrickson
> i.e. in the program below, if main_array was passed to subroutine A in the
> main code, would the shape of the assumed size array in subroutine A be
> dimension(1:10,1:6) ???
>
> thanks in advance,
> Colin.
>
>
> program main
> implicit none
> real, dimension(-1:8, 0:5) :: main_array
> ....
> call A(main_array)
> ....
> contains
>
> subroutine A (2D_array)
> real, dimension(:,:), intent( inout ) :: 2D_array
> ....
> ! transformations carried out on 2D_array
> ....
> end subroutine A
> ....
> ....
> end program
|