home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4251 < prev    next >
Encoding:
Text File  |  1992-11-09  |  2.2 KB  |  54 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!caen!news.cs.indiana.edu!ux1.cso.uiuc.edu!news
  3. From: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  4. Subject: Re: Whats the difference between STATIC variables and SAVE variables?
  5. Message-ID: <BxHG3I.M8r@ux1.cso.uiuc.edu>
  6. Sender: news@ux1.cso.uiuc.edu (News)
  7. Reply-To: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  8. Organization: MRL - UIUC
  9. References: <1992Nov7.161830.7705@netcom.com> <davidm.721341404@voltaire>
  10. Date: Tue, 10 Nov 1992 04:21:04 GMT
  11. Lines: 41
  12.  
  13. In article <davidm.721341404@voltaire>, davidm@voltaire.Rational.COM (David Moore) writes:
  14. |>
  15. |>[ ... good reasons for using SAVE rather than the compilation flag. ]
  16. |>
  17. |>REMARKS:
  18. |>
  19. |>I have seen programs which assume that parameters passed once will remain
  20. |>bound on subsequent calls to entry statements which lack those parameters.
  21. |>For example, this is sometimes used to allocate memory dynamically. When you
  22. |>find such a program, locate the original card deck, drop from the top of a tall
  23. |>building, and see if you can erase all the disk copies before the deck hits
  24. |>the ground (hint; remove the rubber bands)
  25.  
  26. if you use SAVE, what's wrong with this technique ?
  27. you can do poor man's "packages".  i find them very useful when you
  28. have data that you do not want to expose to the whole world, and you want
  29. to act on them in many ways.  example:
  30.  
  31.     call histogram_initialize(n,xmin,xmax)
  32.     ...
  33.     do i=...
  34.         ...
  35.         call histogram_accumulate(x(i))
  36.         ...
  37.     enddo
  38.     call histogram_output
  39.         
  40. and the histogram array (SAVEd, of course) is local to the 'histogram' package, 
  41. which is a single routine with three entry points.
  42. I have this in a lot of programs and find it useful.  I would be delighted to
  43. punch them on cards and do what you suggest (after backup on a DAT),
  44. which is a bit anti-environmental but sounds as lots of fun, but unfortunately 
  45. I cannot find a card puncher around ...  :-)
  46.  
  47. --
  48. Furio Ercolessi
  49. Materials Research Laboratory           |   Intl School for Advanced Studies
  50. Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
  51. furio@uiuc.edu                          |   furio@sissa.it
  52. Path: maureen.cen.uiuc.edu!user
  53. From: mtan@ux1.cso.uiuc.edu (Maureen Tan)
  54.