Is there any reason to use an assumed-size array if the array rank/size are available? -


if know rank and/or size of array being passed function or subroutine, there reason use assumed-shape or assumed-size array? example, if can replace

function f(a,m,n)    real,dimension(*),intent(inout) ::    ! ... end function 

with

function f(a,m,n)     real,dimension(m,n),intent(inout) ::     ! ... end function 

is there reason (in fortran 90 or later) not so?

too long comment, not of answer ...

this

function f(a,m,n)     real,dimension(m,n),intent(inout) ::     ! ... end function 

does not make a assumed-shape array, has explicit shape (m,n). these days write

function f(a)     real,dimension(:,:),intent(inout) ::     ! ... end function 

in version a assumed-shape. on (increasingly) rare occasions need size or shape of array inside procedure writing shape(a) or suchlike.

finally, answer op's question, refer assumed size arrays: colon vs. asterisk - dimension(:) arr vs. arr(*)


Comments