home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
- From: fairfield@slacvx.slac.stanford.edu
- Newsgroups: comp.lang.fortran
- Subject: Re: Whats the difference between STATIC variables and SAVE variables?
- Message-ID: <1992Nov9.230308.1@slacvx.slac.stanford.edu>
- Date: 10 Nov 92 07:03:08 GMT
- Article-I.D.: slacvx.1992Nov9.230308.1
- References: <1992Nov7.161830.7705@netcom.com> <davidm.721341404@voltaire> <BxHG3I.M8r@ux1.cso.uiuc.edu>
- Sender: news@unixhub.SLAC.Stanford.EDU
- Organization: Stanford Linear Accelerator Center
- Lines: 44
-
- In article <BxHG3I.M8r@ux1.cso.uiuc.edu>, ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi) writes:
- > In article <davidm.721341404@voltaire>, davidm@voltaire.Rational.COM (David Moore) writes:
- > |>
- > |>[ ... good reasons for using SAVE rather than the compilation flag. ]
- > |>
- > |>REMARKS:
- > |>
- > |>I have seen programs which assume that parameters passed once will remain
- > |>bound on subsequent calls to entry statements which lack those parameters.
- > |>For example, this is sometimes used to allocate memory dynamically. When you
- > |>find such a program, locate the original card deck, drop from the top of a tall
- > |>building, and see if you can erase all the disk copies before the deck hits
- > |>the ground (hint; remove the rubber bands)
- >
- > if you use SAVE, what's wrong with this technique ?
- > you can do poor man's "packages". i find them very useful when you
- > have data that you do not want to expose to the whole world, and you want
- > to act on them in many ways. example:
- >
- > call histogram_initialize(n,xmin,xmax)
- > ...
- > do i=...
- > ...
- > call histogram_accumulate(x(i))
- > ...
- > enddo
- > call histogram_output
- >
- > and the histogram array (SAVEd, of course) is local to the 'histogram'
- > package, which is a single routine with three entry points.
-
- Sorry, you've missed the point (reread David M.'s paragraph):
- The problem is NOT with having different arguments (and numbers of them)
- for different entry points, nor with SAVE'ng and sharing _local_ variables
- between the entry points. The problem is with SAVE'ng the argument itself.
- Your example is perfectly fine but does not address the objection...
-
- Cheers, Ken
- --
- Dr. Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
- SLAC, P.O.Box 4349, MS 98 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
- Stanford, CA 94309 | BITNET Fairfield@Slacvx
- ----------------------------------------------------------------------------
- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
-