comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: Re: Which is right here - GNAT or OA ?
Date: 1999/05/31
Date: 1999-05-31T00:00:00+00:00	[thread overview]
Message-ID: <928136551.707.11@news.remarQ.com> (raw)
In-Reply-To: 7is6pt$8cd$1@nnrp1.deja.com


Robert Dewar wrote in message <7is6pt$8cd$1@nnrp1.deja.com>...
>In article <928083159.436.79@news.remarQ.com>,
>  "Vladimir Olensky" <vladimir_olensky@yahoo.com> wrote:
>
>Note that you have to be careful in the ase of controlled
>objects not to try to free statically allocated stuff. This
>is a user responsibility in writing the Finalize routine!
>


  That's right  and the very  purpose of this small example (one among some
others)  was to to illustrate why  it is necessary distinguish between
statically allocated and dynamically allocated objects  when using
controlled types for user defined automatic objects deallocation (GB)  to
provide proper program behavior.
I doing this in other examples and this one is explaining why it is
necessary.

I mentioned that I am doing such checks  few months ago in the thread
related to Garbage Collection that arise from time to time here. At  that
time I was wondering if it possible for compiler itself to provide some
additional  compile time info so that RTS could perform such check later
without necessity to do it manually.  I still think that it is possible and
that this is one of the necessary steps on the way of implementing full
featured GB.  Even without system GB  it can make life easier for
programmers.


  As I mentioned I did this stuff  long time ago and now I want to put some
pieces of code to Adapower as "touch and feel" ready to use examples of
using controlled  types. "Touch and feel" is one the best ways to explain
things.  Someone who wants to know can try "touch and feel" example  see the
output read short explanations end comments  and as a result he/she  will
have internal feeling related to that subject.


>So this programs is erroneous, and given that, OA and
>GNAT behave identically, namely they give unpredictable
>results.

As I explained in the first message and in here above it erroneous on
purpose.

It helps to explain why  one should  check if the variable is static prior
to attempt do deallocate it doing finalization (what is being done in my
other examples related to use of controlled types) .
I only  thought that both GNAT and OA will raise exception at  the same
Statement_1.

OA is raising exception  at  -- Statement_1: (   free(q_ptr));

but GNAT performing it without any complains and after that
pointer to that record  get NULL value but object continue to exists.

So at -- Statement_2:    Put( (q1.ID),2)  GNAT is extracting field from the
record and printing it without no problems.

Statement_3 was to show that when q_ptr has NULL value  exception should be
raised here.


-------------------


Regards,

Vladimir Ylensky







  reply	other threads:[~1999-05-31  0:00 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-30  0:00 Which is right here - GNAT or OA ? Vladimir Olensky
1999-05-30  0:00 ` Florian Weimer
1999-05-31  0:00   ` Vladimir Olensky
1999-05-31  0:00     ` Robert Dewar
1999-06-05  0:00       ` Vladimir Olensky
1999-06-05  0:00         ` Vladimir Olensky
1999-06-05  0:00           ` Robert Dewar
1999-06-07  0:00             ` Ada safety road Was: Which is right Vladimir Olensky
1999-06-06  0:00               ` Larry Kilgallen
1999-06-07  0:00                 ` Keith Thompson
1999-06-07  0:00                   ` Hyman Rosen
1999-06-08  0:00                     ` Robert A Duff
1999-06-08  0:00                       ` Keith Thompson
1999-06-09  0:00                         ` Robert Dewar
1999-06-09  0:00                           ` Tucker Taft
1999-06-09  0:00                             ` Robert Dewar
1999-06-09  0:00                         ` dennison
1999-06-09  0:00                           ` Entamology of "Nasal Demons" dennison
1999-06-08  0:00                       ` Ada safety road Was: Which is right Robert Dewar
1999-06-09  0:00                       ` dennison
1999-06-08  0:00                   ` Robert Dewar
1999-06-07  0:00                     ` Keith Thompson
1999-06-08  0:00                     ` Robert A Duff
1999-06-08  0:00                   ` Robert A Duff
1999-06-14  0:00                   ` Ada safety road Franco Mazzanti
1999-06-15  0:00                     ` Franco Mazzanti
1999-06-16  0:00                       ` Vladimir Olensky
1999-06-06  0:00               ` Ada safety road Was: Which is right Robert Dewar
1999-06-07  0:00                 ` Pascal F. Martin
1999-06-07  0:00                   ` Vladimir Olensky
1999-06-08  0:00                 ` Robert A Duff
1999-06-10  0:00               ` Peter Amey
1999-06-10  0:00                 ` Markus Kuhn
1999-06-11  0:00                   ` Vladimir Olensky
1999-06-12  0:00                     ` Robert Dewar
1999-06-12  0:00                       ` JP Thornley
1999-06-13  0:00                         ` Vladimir Olensky
1999-06-16  0:00                         ` William Dale
1999-06-19  0:00                           ` JP Thornley
1999-06-21  0:00                           ` Robert A Duff
1999-06-13  0:00                       ` Vladimir Olensky
1999-06-12  0:00                         ` Matthew Heaney
1999-06-13  0:00                           ` Vladimir Olensky
1999-06-13  0:00                         ` Robert Dewar
1999-06-13  0:00                           ` Vladimir Olensky
1999-06-13  0:00                         ` Robert Dewar
1999-06-13  0:00                           ` swhalen
1999-06-13  0:00                           ` Vladimir Olensky
1999-06-05  0:00         ` Which is right here - GNAT or OA ? Florian Weimer
1999-06-01  0:00   ` Tucker Taft
1999-05-30  0:00 ` Robert Dewar
1999-05-31  0:00   ` Vladimir Olensky [this message]
1999-05-31  0:00     ` Robert Dewar
1999-06-01  0:00   ` dennison
1999-05-31  0:00 ` David Botton
1999-06-01  0:00   ` dennison
1999-06-03  0:00 ` Matthew Heaney
replies disabled

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