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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!hirchert
  3. From: hirchert@ncsa.uiuc.edu (Kurt Hirchert)
  4. Subject: Re: Variable repeat count specifier for FORMAT statments
  5. References: <1992Jul23.215113.16531@jhunix.hcf.jhu.edu> <1992Jul24.012058.21162@ncsa.uiuc.edu> <1992Jul24.152129.16299@newshost.lanl.gov>
  6. Message-ID: <1992Jul26.034105.28542@ncsa.uiuc.edu>
  7. Originator: hirchert@harriett.ncsa.uiuc.edu
  8. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  9. Organization: Nat'l Ctr for Supercomp App (NCSA) @ University of Illinois
  10. Distribution: na
  11. Date: Sun, 26 Jul 1992 03:41:05 GMT
  12. Lines: 32
  13.  
  14. In article <1992Jul24.152129.16299@newshost.lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes:
  15. |>In article <1992Jul24.012058.21162@ncsa.uiuc.edu>, hirchert@ncsa.uiuc.edu (Kurt Hirchert) writes:
  16. |>
  17. |>|> [...]                                            In more complex
  18. |>|> situations, I would build the format on the fly:
  19. |>|> 
  20. |>|>               character*80 fmt
  21. |>|>               ...
  22. |>|>               write (fmt,'(a,i3,a)') '(',n,'(I8))'
  23. |>|>               write (*,fmt) whatever_it_is_you_wanted_to_write
  24. |>
  25. |>Wouldn't it be more legible to write:
  26. |>
  27. |>      character*80 fmt
  28. |>      ...
  29. |>      fmt='(nnn(I8))'
  30. |>      write (fmt(2:4),'(I3)') n
  31. |>      write (*,fmt) whatever_it_is_you_wanted_to_write
  32. |>
  33. |>There is no need to construct the entire value of `fmt' with the internal
  34. |>write, you need only concern yourself with that part which changes.
  35.  
  36. I guess this is a matter of taste.  I don't like the idea of having to
  37. figure out the exact character positions I want to modify (not difficult
  38. in this case, but it could be in a more complex format), and I like even
  39. less the idea of maintaining this position information each time the
  40. format is altered.
  41.  
  42. I also prefer using only two statements.
  43. -- 
  44. Kurt W. Hirchert     hirchert@ncsa.uiuc.edu
  45. National Center for Supercomputing Applications
  46.