[comp.lang.fortran] Fortran 90 pointers

maine@elxsi.dfrf.nasa.gov (Richard Maine) (09/21/90)

On 19 Sep 90 21:37:03 GMT, jlg@lanl.gov (Jim Giles) said:

Jim> ...[discussion of Fortran 90 pointers]...
Jim> So the compiler
Jim> is likely to generate _very_ much more efficient code for the second
Jim> statement.  For this reason (and this is a simple example - real
Jim> cases would be even more likely to cause problems) the user would
Jim> naturally prefer to use the second notation everywhere.
                                                 ^^^^^^^^^^

I've got to dispute the generality of that claim, Jim.  (And I still
consider myself a "user").  You have given an argument why the pointer
notation might be worse for those sections of code that are time
critical.  I'm not 100% convinced that I'll really see the difference.
Seems like every time I try out a new compiler option or version that
claims great performance improvements from optimizations like those
that you say should be better in the non-pointer form, I can't measure
the difference on my codes.  (I don't run Whetstones or other
standardized benchmarks for a living).  But I'll grant that it is
possible that this case may be different or that other applications
may see more of the benefits.

In any case, this argument is irrelevant to the 90% (pick your favorite
number, but that's the right ballpark) of the code that is not time
critical.  We have long passed the days where speed was the only criterion
used in programming every line of code.  For the few places in the code
where it really matters, you may have an argument.  You have done
*nothing* to support the "everywhere" in your claim.

The current version of one of my major programs runs about 30% slower
than it's ancestors of the 70's era.  Yet nobody here uses the older
program any more.  Perhaps it is because the newer program is more
robust, readable, maintainable, easier to use, flexible, and other
good things like that.  (Anyway, I think so; and the old program was
mine too, so I have the right to flame it :-)).  Although each run
of the new program takes more time, somehow the job seems to get done
in fewer runs and there is stronger confidence in the results.
(At least in the difficult cases; the easy cases aren't at issue).
Plus, of course, the computer hardware has sped up a lot more than
the program has slowed down.

None of my comments above are likely to win any prizes as unique
new insights.  Back to Fortran 90 pointers.

I think that array section pointers used "appropriately" can help make
some of my codes clearer, easier to write and maintain, and less
prone to bugs.  Thus, I prefer that notation in many places.  I found
the IDENTIFY and RANGE features of the earlier F90 draft to be far
more confusing and thus more bug prone (at least to me).

I don't doubt that there are users with opposing viewpoints.  (I'd have
to be pretty blind not to notice, eh? :-)).  But I am sure that Jim's
claims about what users will want *everywhere* are overly broad.

Jim> So why is the pointer-to-section feature in the standard at all?

Perhaps one of the reasons X3J3 left pointers to array sections in the
standard was that they listened to some users that liked it.  I know
that I commented favorably on it as opposed to IDENTIFY/RANGE in my
formal comments.

Not that I haven't had some problems adapting to the "strong typing"
of Fortran 90 pointers, but that's another subject (I think).  Perhaps
I'll do a separate post on my difficulties in that area.  This one is
long enough.


--

Richard Maine
maine@elxsi.dfrf.nasa.gov [130.134.64.6]