Petros Dafniotis, DuPont Central R & D writes:
> Implementation: Fortran95 code follows at end of email.
...
> my_trim = s(1:LEN_TRIM(s))
Note that, while legal, the substring on the right is superfluous.
I suggest just
my_trim = s
your compiler is sufficiently smart then both versions will be
identical. But I think the odds are fairly high that the compilers
won't be quite that smart. So they will end up producing the same
result, but I'll bet yours is slower. The compiler will probably
actually go through the unnecessary evaluation of len_trim(s), and
might even make a unnecessary temporary string. I haven't taken the
time to verify what the compilers will actually do. Perhaps your
compilers are smarter than I'd expect. But I'd say that the *BEST*
you could plausibly hope for is that you version is the same speed.
In this case, I'd say simpler is better.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|