F2003+ standard question regarding passing a scalar character to an array



Hello all,

I have problems with the following quote from the standard; I can read it in two ways: Either being a character is enough or such that a non-array-element scalar character is differently treated than one which is an array element. (The wording in F2003 is the same except for "noncoindexed" and "polymorphic".)

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."


Thus, is the following program valid or not? Would there be a difference if one had a substring ["x(1)(1:1)"] or not?

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 (and not an array element) is always valid - substring or not, isn't it?

Tobias

PS: My feeling is that it requires an interpretation request though maybe I simply cannot read. In any case, as the next J3 meeting is already tomorrow, one has plenty of time to decide whether one should write an IR for the next meeting ...
.



Relevant Pages

  • Re: Dynamically updating perl variables
    ... character of multi-character parameter values. ... The intention was that, once the data was in a Perl data structure, the calling ... the case of your given data subroutine would return a list that, ... nice to see what a full alternative solution would look like using your ideas. ...
    (perl.beginners)
  • Re: reading more data than the record size (RECL)
    ... it writes an array as one vector. ... character id*56 ... c This subroutine reads a standard file into a one-dimensional ... call row_write(lun, work, ncol) ...
    (comp.lang.fortran)
  • Re: Dynamic character length?
    ... > I need to set character length in the middle of a subroutine. ... allows automatic allocation of allocatables on assignment, ... implementations of it. ...
    (comp.lang.fortran)
  • Re: substrings and array sections
    ... implicit none ... character:: a ... subroutine bar ... end program foo ...
    (comp.lang.fortran)
  • Re: How to return a variable length substring from a function ?
    ... implicit none ... character(*) function fun ... end function fun ... subroutine g ...
    (comp.lang.fortran)