| jamesgiles@att.net 2008-02-14, 7:14 pm |
| On Feb 14, 8:27=A0am, "Craig Dedo" <cd...@wi.rr.com> wrote:
> "Gary Scott" <garylsc...@sbcglobal.net> wrote in message
>
> news:SrXsj.11007$J41.4633@newssvr14.news.prodigy.net...
>
>
[color=darkred]
=2E..[color=darkred]
> =A0 =A0 I have never understood what the problems and limitations are or c=
ould be.
> Variable Format Expressions (VFE) have been an extension in many Fortran
> compilers for over two decades. =A0AFAIK, they are always implemented with=
the
> same capabilities and limitations. =A0Thus, it appears that the technology=
for
> implementing them is well known and well understood. =A0If there are subst=
antial
> problems and limitations, please explain what they are.
VFEs cannot be applied to all character strings. In fact, they can't
be
applied to all strings that are used as formats. Only those formats
that
are literals in the I/O statement and those defined in a FORMAT
statement
may have VFEs in them. In my case, that pretty much excludes using
them
at all.
Further, the VFEs don't establish a meaning of the format string at
the
start of the I/O statement in which they're used, they are evaluated
when the I/O sequence reaches that point in the format. This means
they may be evaluated multiple times (format reversion). They might
reference variables that are I/O list items - and if this is a READ,
their meaning is even tougher to discern. And what if the VFE is the
count for a left TAB specifier? You could be processing an unknown
portion of the input an unknown number of times. Where do you draw
the line?
I much prefer extending string concatenate so that it's defined mixed-
mode on integers as well. I already do this:
fmt =3D "(5x, " // n // "I" // w // ")"
Here, the integer variables (or named constants) N and W supply the
number and width of the I specifier. I can then use this as a format
in an I/O statement. Or, I can use the same feature to create strings
that contain converted numbers for other purposes. My implementation
of concatenate doesn't use internal I/O, so it doesn't conflict with
pre-f2003 "recursive I/O" requirements and it's faster. I find it
more
legible.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
|