On Wed, 23 Aug 2000, Malcolm Cohen wrote:
> My Fortran (77) text manipulation code uses assumed-length character rather
> a lot, indeed probably most of the time. YCMV.
Indeed, so does mine; I think prudent programmers normally use passed
length for all character arguments.
> That is because it is perfectly legal and reasonably commonly used.
Legal, but I doubt if it's commonly used. I can't recall having used the
feature [actual string arg longer than dummy] and whenever I've seen it in
code written by others it's always the result of a mistake, in my
experience.
> And the pointer version of the varying-string module (i.e. the one which
> leaks memory) can be used on compilers with garbage collectors. This is
> becoming more common.
I'm wary of relying on garbage collection: it's seems to me a bit like
buying a home with a roof known to leak, and being reassured that the
vendor will provide a free set of buckets. Except that in this case the
buckets are invisible and intangible, and you just have to hope that they
are catching all the water when it rains, since you will only find you
were wrong when your house crashes to the ground. Or is this an
unreasonable analogy?
> varying-string standard is attempting to fill. Even if we already had the
> F2002 facilities to allocate strings of variable length, the varying-string
> standard remains a more convenient method of string manipulation.
It seems a pity that Fortran, which has long had a useful string type, can
only handle dynamic strings as components of derived type by features
which, essentially, tranform each string into an array of single
characters. It's not much less primitive than the features of C which
many programmers find infuriating.
> one might draw the conclusion that there are relatively few users demanding
> this feature.
I guess you are right. So I'll stop moaning about it.
Regards
--
Clive Page,
Dept of Physics & Astronomy,
University of Leicester.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|