Re: Save statement
- From: "Steve Lionel" <steve.lionel@xxxxxxxxx>
- Date: 17 Dec 2006 14:21:04 -0800
allelopath wrote:
Is "automatic" the complement/opposite of "save"?
AUTOMATIC and STATIC are non-standard extensions, so they can mean
whatever the implementor wants them to, In practice, STATIC requests
that the compiler choose a fixed address for the variable's memory,
AUTOMATIC requests that the variable be allocated to storage that is
created for the duration of the routine call and discarded afterward;
this usually means the stack but it could also be registers or even
heap memory that gets deallocated on routine exit.
When I say "requests" that's because the language semantics may
override your request.
SAVE is a semantic term and does not necessarily tie into where the
variable is allocated in memory. A variable with the SAVE attribute
retains its definition status and value across calls to the routine,
It is true that this is usually implemented using static allocation,
but there's nothing in the standard requiring that. That said, most
compilers which support AUTOMATIC will give you an error if you also
say SAVE (or specify initialization which usually (but not always)
implies SAVE.)
Steve
.
- References:
- Save statement
- From: allelopath
- Re: Save statement
- From: Paul van Delst
- Re: Save statement
- From: allelopath
- Re: Save statement
- From: Jugoslav Dujic
- Re: Save statement
- From: allelopath
- Save statement
- Prev by Date: Re: Fortran UUID Generator
- Next by Date: Re: Fortran UUID Generator
- Previous by thread: Re: Save statement
- Next by thread: Re: Save statement
- Index(es):
Relevant Pages
|