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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!sdd.hp.com!elroy.jpl.nasa.gov!nntp-server.caltech.edu!draco.macsch.com!convex.is.macsch.com!dnl
  3. From: dnl@convex.is.macsch.com (David Lombard)
  4. Subject: Re: Whats the difference between STATIC variables and SAVE variables?
  5. Message-ID: <1992Nov11.171006.18467@draco.macsch.com>
  6. Sender: usenet@draco.macsch.com (Usenet Poster)
  7. Organization: MacNeal-Schwendler Corp.
  8. References: <1992Nov7.161830.7705@netcom.com> <1992Nov9.190426.13544@photon.com>
  9. Date: Wed, 11 Nov 92 17:10:06 GMT
  10. Lines: 28
  11.  
  12. In article <1992Nov9.190426.13544@photon.com> wmc@photon.com (Bill Cornette) writes:
  13.  
  14. ...Context removed...
  15. >
  16. >    Obviously (at least to me), STATIC (when not required) takes extra 
  17. >execution time.  The code must save all variables in a stack somewhere and
  18. >reinitialize all variables whenever entering a routine.  I would avoid
  19. >it in all home-grown programs for this reason, but as noted above, you
  20. >may want to use it routinely for all imported codes.
  21. >
  22.  
  23. STATIC will assign fixed locations for each variable in the routine, i.e.
  24. stack IS NOT used.  The problem is that each routine compiled STATIC will
  25. carve out its own chunk of memory to hold its variables during the 
  26. life of the program.  *Reinitialization* is not done.  As a result,
  27. if the routine is not currently active, or is not a parent of the
  28. currently active routine, its variable space is sitting unused.
  29.  
  30. Your *understanding* of the mechanism is a little flawed.
  31.  
  32. Regards,
  33. DNL
  34.  
  35.                  MY_COMMENTS = MY_OPINIONS = NOBODY_ELSES;
  36.  
  37. David N. Lombard    The first thing we do,         The MacNeal-Schwendler Corp
  38. dnl@macsch.com      Let's kill all the lawyers.    815 Colorado Blvd
  39. (213) 259-4911      II Henry VI, IV.ii             Los Angeles, CA  90041
  40.