home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4252 < prev    next >
Encoding:
Internet Message Format  |  1992-11-09  |  2.5 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
  2. From: fairfield@slacvx.slac.stanford.edu
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Whats the difference between STATIC variables and SAVE variables?
  5. Message-ID: <1992Nov9.230308.1@slacvx.slac.stanford.edu>
  6. Date: 10 Nov 92 07:03:08 GMT
  7. Article-I.D.: slacvx.1992Nov9.230308.1
  8. References: <1992Nov7.161830.7705@netcom.com> <davidm.721341404@voltaire> <BxHG3I.M8r@ux1.cso.uiuc.edu>
  9. Sender: news@unixhub.SLAC.Stanford.EDU
  10. Organization: Stanford Linear Accelerator Center
  11. Lines: 44
  12.  
  13. In article <BxHG3I.M8r@ux1.cso.uiuc.edu>, ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi) writes:
  14. > In article <davidm.721341404@voltaire>, davidm@voltaire.Rational.COM (David Moore) writes:
  15. > |>
  16. > |>[ ... good reasons for using SAVE rather than the compilation flag. ]
  17. > |>
  18. > |>REMARKS:
  19. > |>
  20. > |>I have seen programs which assume that parameters passed once will remain
  21. > |>bound on subsequent calls to entry statements which lack those parameters.
  22. > |>For example, this is sometimes used to allocate memory dynamically. When you
  23. > |>find such a program, locate the original card deck, drop from the top of a tall
  24. > |>building, and see if you can erase all the disk copies before the deck hits
  25. > |>the ground (hint; remove the rubber bands)
  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. >     call histogram_initialize(n,xmin,xmax)
  31. >     ...
  32. >     do i=...
  33. >         ...
  34. >         call histogram_accumulate(x(i))
  35. >         ...
  36. >     enddo
  37. >     call histogram_output
  38. >         
  39. > and the histogram array (SAVEd, of course) is local to the 'histogram' 
  40. > package, which is a single routine with three entry points.
  41.  
  42.     Sorry, you've missed the point (reread David M.'s paragraph): 
  43. The problem is NOT with having different arguments (and numbers of them)
  44. for different entry points, nor with SAVE'ng and sharing _local_ variables
  45. between the entry points.  The problem is with SAVE'ng the argument itself.
  46. Your example is perfectly fine but does not address the objection...
  47.  
  48.         Cheers, Ken
  49. -- 
  50.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  51.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  52.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  53.  ----------------------------------------------------------------------------
  54.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  55.