Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!lll-tis!ohlone!nelson
From: nelson@ohlone.UUCP (Bron Nelson)
Newsgroups: comp.lang.fortran
Subject: Re: ALLOCATABLE, ARRAY :: A(:)
Message-ID: <250@ohlone.UUCP>
Date: Thu, 9-Jul-87 13:57:23 EDT
Article-I.D.: ohlone.250
Posted: Thu Jul  9 13:57:23 1987
Date-Received: Sun, 12-Jul-87 09:11:35 EDT
References: <1215@batcomputer.tn.cornell.edu> <105@anumb.UUCP> <3538@watvlsi.UUCP> <3174@cit-vax.Caltech.Edu>
Organization: Cray Research Inc., Livermore, CA
Lines: 28
Summary: Passing array sections vs. passing scalars

In article <3174@cit-vax.Caltech.Edu>, walton@tybalt.caltech.edu (Steve Walton) writes:
>       I think the way out is actually in the spec: if you do CALL
> SUB(A) you are passing a pointer to a pointer to A.  If you do CALL
> SUB(A(5)), you are passing element 5 of a as a scalar, and that is a
> call by reference.  To send elements 5 through 10 of A to SUB, you
> must do CALL SUB(A(5:10)), in my current reading of the spec.  So, you
> can unambiguously tell at compile time whether a scalar or an array is
> intended and pass a pointer in the first instance and a
> pointer-to-a-pointer in the second instance. 
>      Does this sound reasonable?
> 
Sure it sounds reasonable, and would that it were so, but ...

Section B.3.1.2 of the Apr87 draft clearly states that the old Fortran77
practice of passing an array section by passing the first element must
continue to be supported (the document does go so far as to admit it
is bad form at least).  Thus

	call foo(a(5))
	...
	subroutine foo(s)
	integer s(5)

is still legal.  Of course, foo(a(5:10)) is ALSO legal.

-----------------------
Bron Nelson     {ihnp4, lll-lcc}!ohlone!nelson
Not the opinions of Cray Research