From: jsa@alexandria (Jon S Anthony)
Subject: Re: Static variables?
Date: 1997/03/18
Date: 1997-03-18T00:00:00+00:00 [thread overview]
Message-ID: <JSA.97Mar17193855@alexandria> (raw)
In-Reply-To: 332D71FF.4773@cae.ca
In article <332D71FF.4773@cae.ca> Viqar Abbasi <viqar@cae.ca> writes:
> Is there a way to declare local variables in ADA subprograms to be
> STATIC? That is, they retain the value that they had when the
> subprogram was last exited.
This may be in the FAQ (see: www.adahome.com for the FAQ).
Just put the variable at the same or lower scope than the subprogram
that is to use it. Typically this is at package level.
Ex.1:
procedure P is
V : Some_Variable_Type ...
procedure Sub_P is
...-- V works as you wish for all invocation of Sub_P
end Sub_P;
...
end P;
Ex.2:
package P is
V: Some_Variable_Type ....
procedure P1 ...
procedure P2 ...
...
-- V works as you wish for all invocations of any Px here
-- (also for any subprograms in the body of P and any child unit
-- of P or, for that matter, any importer of P (with P...)
end P;
/Jon
--
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com
next prev parent reply other threads:[~1997-03-18 0:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-17 0:00 Static variables? Viqar Abbasi
1997-03-17 0:00 ` Robert Dewar
1997-03-18 0:00 ` nasser
1997-03-18 0:00 ` Jon S Anthony [this message]
1997-03-18 0:00 ` Samuel Tardieu
1997-03-18 0:00 ` Tom Moran
1997-03-19 0:00 ` Robert Dewar
1997-03-25 0:00 ` Richard A. O'Keefe
1997-03-25 0:00 ` Larry Kilgallen
1997-03-27 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox