From: nasser@apldbio.com
Subject: Re: Static variables?
Date: 1997/03/18
Date: 1997-03-18T00:00:00+00:00 [thread overview]
Message-ID: <5go0s7$2un@lana.zippo.com> (raw)
In-Reply-To: dewar.858642450@merv
as Dr Dewar mentioned, package variables retain their values
from the time the package becomes avaliable to the time the
package life ends (usually the end of the program , but not
always the case, example, if the package is declared inside
a block or procedure), may be a picture will help:
package A interface
+---------------------+
| i: integer; -----------> retain its value also
client <=======> | procedure foo; |
| ....... |
+---------------------+
.............................................
package A body
+---------------------+
|j: integer; --------------> these variables retain
| | their values
| procedure foo is |
| n: integer; ------------> variables here are auto
| begin | variables, new copies are
| .... | created each time foo is called
| end foo; |
| |
| begin |
| .... ----------------> this code execute once when
| end A; | package is first elaborated.
| | use this code to init package
+---------------------+ variables.
you can think of variables declared in the package interface as static puplic
in C++ class terminolgy, and variables declared in the body of the package
but outside the functions and procedure of the package body as static
private in C++.
offcourse it is a good idea to try to avoid using variables in the interface
part of the package.
nasser
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 [this message]
1997-03-18 0:00 ` Jon S Anthony
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