Re: Save statement



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

.



Relevant Pages

  • Re: Structure of large link libraries in f95
    ... I cited LAPACK as an example that might be of general interest, ... which LAPACK90 shows just how ugly option 2 can get. ... It isn't intrinsically hard to do, but Sun's compiler ... the requests for compile-to-archive stopped, ...
    (comp.lang.fortran)
  • Re: C++ in KMDF
    ... compiler that generates safe drivers ... represent merely a puny squeak amid the vast din of feature requests from ... There is a wall between the compiler teams and the DDK teams. ...
    (microsoft.public.development.device.drivers)
  • Re: non-functional backout for review
    ... Compiler gives almost identical code for old and ... New one (requests for backout) ... I will use a version which compiler can generate optimized code. ...
    (freebsd-current)
  • Re: Is the Ada run-time required to detect out-of-memory conditions?
    ... > CPU will only handle memory requests of at least one page. ... > When larger memory is requested some C compiler will just pass the request ... "The terrorists rejoice in the killing of the innocent, ...
    (comp.lang.ada)
  • Re: [PATCH scsi-misc-2.6 04/04] scsi: remove unnecessary scsi_wait_req_end_io()
    ... > BLKPREP_KILL, which it still does even after your patch set, so the ... Actually, for special requests, the only tests performed ... I don't feel strong against keeping the end_io routine but, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)