Re: Calling Fortran 77 from Fortran 95
 From: nospam@xxxxxxxxxxxxx (Richard Maine)
 Date: Sun, 6 Mar 2011 15:53:54 0800
sturlamolden <sturlamolden@xxxxxxxx> wrote:
On 6 Mar, 20:51, n...@xxxxxxxxx wrote:
Just write the obvious code and it will all work.
real :: X(100,4)
X(1:10,:) ! whats the leading dimension of this? 10 or 100?
10, when passed to a procedures that uses an explicitshape or
assumedsize argument, as LAPACK and all other Fortran 77 code
does.
So if I pass a slice like X(1:10,:) as an explicitshape or assumed
size array, I can depend on the compiler to make a temporary copy and
pass a contiguous array?
In practice, yes. The standard doesn't exactly say that. But it does say
that passing a slice like that to an explicitshape or assumedsize
dummy array must work. A compiler could legally implement explicitshape
and assumedsize arrays with things like dope vectors that accomodated
noncontiguous arrays, but none of them do... well almost none, and
anyway none you are likely to run in to.
In any case, the standard does require that the compiler do whatever is
needed to make passing such a slice work. If the compiler needs
contiguity for explicitshape or assumedsize dummy arrays (as almost
all compilers do), then it has to do something to get such a contiguous
version. In practice, that means making a copy. I suppose one could
imagine some kind of esoteric virtual memory remapping, but it would
just be imagination.

Richard Maine  Good judgment comes from experience;
email: last name at domain . net  experience comes from bad judgment.
domain: summertriangle   Mark Twain
.
 FollowUps:
 Re: Calling Fortran 77 from Fortran 95
 From: nmm1
 Re: Calling Fortran 77 from Fortran 95
 From: glen herrmannsfeldt
 Re: Calling Fortran 77 from Fortran 95
 From: sturlamolden
 Re: Calling Fortran 77 from Fortran 95
 References:
 Calling Fortran 77 from Fortran 95
 From: sturlamolden
 Re: Calling Fortran 77 from Fortran 95
 From: nmm1
 Re: Calling Fortran 77 from Fortran 95
 From: sturlamolden
 Re: Calling Fortran 77 from Fortran 95
 From: nmm1
 Re: Calling Fortran 77 from Fortran 95
 From: sturlamolden
 Calling Fortran 77 from Fortran 95
 Prev by Date: Re: Calling Fortran 77 from Fortran 95
 Next by Date: Re: Calling Fortran 77 from Fortran 95
 Previous by thread: Re: Calling Fortran 77 from Fortran 95
 Next by thread: Re: Calling Fortran 77 from Fortran 95
 Index(es):
Relevant Pages
