home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nntpd.lkg.dec.com!engage.pko.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
- From: lionel@quark.enet.dec.com (Steve Lionel)
- Subject: Re: Variable repeat count specifier for FORMAT statments
- Message-ID: <1992Jul24.183733.13887@e2big.mko.dec.com>
- Sender: guest@e2big.mko.dec.com (Guest (DECnet))
- Organization: Digital Equipment Corporation
- References: <1992Jul23.215113.16531@jhunix.hcf.jhu.edu> <BURLEY.92Jul24125501@geech.gnu.ai.mit.edu>
- Distribution: na
- Date: 24 JUL 92 14:19:23
- Lines: 40
-
-
- In article <BURLEY.92Jul24125501@geech.gnu.ai.mit.edu>,
- burley@geech.gnu.ai.mit.edu (Craig Burley) writes...
- >In article <1992Jul23.215113.16531@jhunix.hcf.jhu.edu>
- > psun@jhunix.hcf.jhu.edu (Peter Sun) writes:
- >
- > My apologies if this questions seems trivial, but I've tried to find the
- > answer in so many places. I need to know how to give a variable as the
- > number of repeat counts to a format field descriptor statement. For
- > example I know on VAX/VMS this can be done with something like:
- >
- > write (*, '(<n>(I8))')
- >
- >
- >What you show is nonstandard and probably doesn't work on VAX/VMS either.
-
- If you ignore the variable format expression (the <n> construct), this IS
- standard FORTRAN-77, and certainly does work on VMS. The relevant portion
- of the standard is page 12-8, lines 17-22, which say that a "format identifier"
- may be:
-
- (4) Any character expression except a character expression
- involving concatenation of an operand whose length
- specification is an asterisk in parentheses unless the
- operand is the symbolic name of a constant. Note that
- a character constant is permitted.
-
- Craig then goes on to give a very accurate description of how VAX FORTRAN
- deals with formats and variable format expressions. VAX FORTRAN does allow
- arbitrary expressions in the VFE, including formal arguments and external
- function calls. A compiler dealing with VFEs needs to be aware of
- what variables are used inside VFEs when considering optimizations. It gets
- even more fun when the variables used in the VFE aren't at static addresses
- (one solution is to pass a context pointer into the Run-Time Library).
-
- Steve Lionel lionel@quark.enet.dec.com
- SDT Languages Group
- Digital Equipment Corporation
- 110 Spit Brook Road
- Nashua, NH 03062
-