On Mon, 3 May 2004, Drew McCormack wrote:
> Is the following legal fortran 90?
>
>
> module A
> contains
> subroutine sub( array )
> real :: array(10)
> end subroutine
> end module
>
>
> program main
> use A
> real :: a, b(10), c(10,10)
> call sub(a)
> call sub(b)
> call sub(c)
> end program
>
>
> In other words, if you have an explicit interface, can you pass
> non-conforming arrays?
"call sub(b)" and "call sub(c)" are legal. but "call sub(a)" is not legal
for two reasons: 1) conflicting name with module name. 2) passing scalar to
array dummy argument. if you had used an assumed shape dummy argument
like real :: array(:) then "call sub(b)" is legal. passing c(10,10) to
array(10) (assumed size array) is legal. the sub will use only first 10
elements of "c"
renchi
|