home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2826 < prev    next >
Encoding:
Text File  |  1992-07-25  |  2.3 KB  |  53 lines

  1. Newsgroups: comp.lang.fortran
  2. 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
  3. From: lionel@quark.enet.dec.com (Steve Lionel)
  4. Subject: Re: Variable repeat count specifier for FORMAT statments
  5. Message-ID: <1992Jul24.183733.13887@e2big.mko.dec.com>
  6. Sender: guest@e2big.mko.dec.com (Guest (DECnet))
  7. Organization: Digital Equipment Corporation
  8. References: <1992Jul23.215113.16531@jhunix.hcf.jhu.edu> <BURLEY.92Jul24125501@geech.gnu.ai.mit.edu>
  9. Distribution: na
  10. Date: 24 JUL 92 14:19:23    
  11. Lines: 40
  12.  
  13.  
  14. In article <BURLEY.92Jul24125501@geech.gnu.ai.mit.edu>, 
  15. burley@geech.gnu.ai.mit.edu (Craig Burley) writes...
  16. >In article <1992Jul23.215113.16531@jhunix.hcf.jhu.edu> 
  17. > psun@jhunix.hcf.jhu.edu (Peter Sun) writes:
  18. >   My apologies if this questions seems trivial, but I've tried to find the
  19. >   answer in so many places.  I need to know how to give a variable as the
  20. >   number of repeat counts to a format field descriptor statement.  For
  21. >   example I know on VAX/VMS this can be done with something like:
  22. >              write (*, '(<n>(I8))')
  23. >What you show is nonstandard and probably doesn't work on VAX/VMS either.
  24.  
  25. If you ignore the variable format expression (the <n> construct), this IS
  26. standard FORTRAN-77, and certainly does work on VMS.  The relevant portion
  27. of the standard is page 12-8, lines 17-22, which say that a "format identifier"
  28. may be:
  29.  
  30.     (4) Any character expression except a character expression
  31.         involving concatenation of an operand whose length 
  32.         specification is an asterisk in parentheses unless the
  33.         operand is the symbolic name of a constant.  Note that
  34.         a character constant is permitted.
  35.  
  36. Craig then goes on to give a very accurate description of how VAX FORTRAN
  37. deals with formats and variable format expressions.  VAX FORTRAN does allow
  38. arbitrary expressions in the VFE, including formal arguments and external
  39. function calls.  A compiler dealing with VFEs needs to be aware of
  40. what variables are used inside VFEs when considering optimizations.  It gets
  41. even more fun when the variables used in the VFE aren't at static addresses
  42. (one solution is to pass a context pointer into the Run-Time Library).
  43.  
  44. Steve Lionel                    lionel@quark.enet.dec.com
  45. SDT Languages Group
  46. Digital Equipment Corporation
  47. 110 Spit Brook Road
  48. Nashua, NH 03062
  49.