(j3.2006) Standard question regarding passing a scalar string to an array

Tobias Burnus burnus
Sun Feb 13 05:07:27 EST 2011


Hello all,

F2008, "12.5.2.4 Ordinary dummy variables":

"If the actual argument is a noncoindexed scalar, the corresponding 
dummy argument shall be scalar unless the actual argument is default 
character, of type character with the C character kind (15.2.2), or is 
an element or substring of an element of an array that is not an 
assumed-shape, pointer, or polymorphic array."


Is the following program valid or invalid? Namely, shall I read only 
until "unless the actual argument is default character" - regarding the 
rest as belong to "or". Or does the "element of an array that is not 
a... pointer ... array" also apply? Would it be different if I had 
substring?

subroutine t(x)
  character, pointer :: x(:)
  call f(x(1))
contains
   subroutine f(a)
      character :: a(*)
   end subroutine f
end subroutine


I assume a character actual argument which is a (scalar) pointer is 
always valid - substring or not, isn't it?

Tobias



More information about the J3 mailing list