Hello,
> P.S. There are a whole host of other things wrong with this also. The
> pointer version will blow you out of the water if the compiler does
> copy-in/copy-out.
>
> Fortran pointers are not like C pointers. They "know" the size of
> their target - and you'll tend to have troubles if you try to
> address outside of the target.
Thanks. I know this well, and that is all good design so long as one does
not run into special cases, such as the one I talked about last week--skip
lists, where one needs an array of pointers but really does not need the
whole memory overhead of an array descriptor because no bound, stride, or
size info is needed. In fact, this overhead is twice to three times as large
as actually needed.
If Fortran had allocatable buffers (not arrays?), something like:
REAL, DIMENSION(1:*), ALLOCATABLE :: x
where x needs NO array desciptor--lower bound must be 1, stride is 1, and
upper bound is not needed:
ALLOCATE(x(100)) --- allocates a contigious memory buffer of size 100
WRITE(*,*) x(10)
then I could avoid such overhead. But yes, this smells like C a lot and I am
not really proposing it, just pointing out that the safe and portable syntax
of F95 sometimes costs too much in performance and there is no legal
workaround in this case...
Aleksandar
_____________________________________________
Aleksandar Donev
http://www.pa.msu.edu/~donev/
[log in to unmask]
(517) 432-6770
Department of Physics and Astronomy
Michigan State University
East Lansing, MI 48824-1116
_____________________________________________
|