Hello,
> Well, in case of compiler creating temporary (copy-in/copy-out), I
> don't think you solution works. For x(1), a compiler has more reason to
> create temporary.
>
> In cases similar to your example, I normally add one intemediate
> interface:
>
> module m_test
> contains
> subroutine test_n(a,n)
> integer,intent(in) :: n
> real ,intent(??) :: a(n)
> call test(a(1)) ! shouldn't it be "test(a(1),n)"? [ Yes, I was just
> abreviating things]
> end subroutine test_n
> end module m_test
Your solution definitely won't work, since a still needs to be contiguous (it
is explicit shape--a(n)), and a compiler that would create a temporary would
do it even with the explicit interface. Passing x(1) has worked for me with
some compilers, but it is definitely not a clean way. I agree with Richard
too, but there is more to life then what I want--is what I can afford :(
Someone suggested Cray pointers to me. They are supported by most compilers
and can do the job it seems. Not pretty, but doable...
Thanks,
Aleksandar
--
__________________________________
Aleksandar Donev
Complex Materials Theory Group (http://cherrypit.princeton.edu/)
Princeton Materials Institute & Program in Applied and Computational
Mathematics
@ Princeton University
Address:
419 Bowen Hall, 70 Prospect Avenue
Princeton University
Princeton, NJ 08540-5211
E-mail: [log in to unmask]
WWW: http://atom.princeton.edu/donev
Phone: (609) 258-2775
Fax: (609) 258-6878
__________________________________
|