comp.lang.ada
 help / color / mirror / Atom feed
From: "Pat Rogers" <progers@NOclasswideSPAM.com>
Subject: Re: access type question (maybe a little silly)
Date: 2000/10/19
Date: 2000-10-19T00:00:00+00:00	[thread overview]
Message-ID: <lXMH5.902$Xs6.91167@nnrp1.sbc.net> (raw)
In-Reply-To: ezLH5.6327$Uk1.151137@telenews.teleline.es

"Carles" <e3128927@est.fib.upc.es> wrote in message
news:ezLH5.6327$Uk1.151137@telenews.teleline.es...
> Do access type objects need to be destructed when they are not
longer used?

That depends upon what you really mean by "access type objects".  If
you mean that literally, the answer is "probably not", since they are
likely declared on the stack.  (Yes one can have access values that
designate other access values, but that is somewhat unusual and will
be covered by the second part of the answer.)

In the following,

    type T is access all Integer;

    P : T;

the object P is of type T (I'm being somewhat loose with the
terminology; it won't hurt).   Object P could reasonably be called an
"access type object".

If what you really mean is "do the values *designated* by access type
objects need to be destroyed when no longer used" then the answer
depends.  After this statement,

    P := new Integer;

P.all is the (Integer) object designated by P, which comes out of some
pool (sort of a heap).   Does that integer need to be deallocated?
Depends upon what you're doing.  There is, however, likely no garbage
collector unless you're targeting to the JVM.  (I know of no Ada
compilers that provide GC apart from those that target the JVM, due to
lack of demand.)

If you're running an application that executes for a very long time,
then you might want to do the reclamation.  If you're running a
desktop, one-off, short-lived application, then it probably won't be
worth the effort.  The bottom line is that it depends upon the nature
of the application domain, the behavior of the program, and the
environment in which it runs.

---
Patrick Rogers                      Consulting and Training in:
http://www.classwide.com      Deadline Schedulability Analysis
progers@classwide.com        Software Fault Tolerance
(281)648-3165                       Real-Time/OO Languages

Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain






  reply	other threads:[~2000-10-19  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-19  0:00 access type question (maybe a little silly) Carles
2000-10-19  0:00 ` Pat Rogers [this message]
2000-10-20  2:01   ` David Starner
2000-10-20  0:00     ` Pat Rogers
2000-10-20  0:00     ` Robert Dewar
2000-10-20  0:34 ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox