home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- 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
- From: dnl@convex.is.macsch.com (David Lombard)
- Subject: Re: Whats the difference between STATIC variables and SAVE variables?
- Message-ID: <1992Nov11.171006.18467@draco.macsch.com>
- Sender: usenet@draco.macsch.com (Usenet Poster)
- Organization: MacNeal-Schwendler Corp.
- References: <1992Nov7.161830.7705@netcom.com> <1992Nov9.190426.13544@photon.com>
- Date: Wed, 11 Nov 92 17:10:06 GMT
- Lines: 28
-
- In article <1992Nov9.190426.13544@photon.com> wmc@photon.com (Bill Cornette) writes:
-
- ...Context removed...
- >
- > Obviously (at least to me), STATIC (when not required) takes extra
- >execution time. The code must save all variables in a stack somewhere and
- >reinitialize all variables whenever entering a routine. I would avoid
- >it in all home-grown programs for this reason, but as noted above, you
- >may want to use it routinely for all imported codes.
- >
-
- STATIC will assign fixed locations for each variable in the routine, i.e.
- stack IS NOT used. The problem is that each routine compiled STATIC will
- carve out its own chunk of memory to hold its variables during the
- life of the program. *Reinitialization* is not done. As a result,
- if the routine is not currently active, or is not a parent of the
- currently active routine, its variable space is sitting unused.
-
- Your *understanding* of the mechanism is a little flawed.
-
- Regards,
- DNL
-
- MY_COMMENTS = MY_OPINIONS = NOBODY_ELSES;
-
- David N. Lombard The first thing we do, The MacNeal-Schwendler Corp
- dnl@macsch.com Let's kill all the lawyers. 815 Colorado Blvd
- (213) 259-4911 II Henry VI, IV.ii Los Angeles, CA 90041
-