comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Which is right here - GNAT or OA ?
Date: 1999/06/03
Date: 1999-06-03T00:00:00+00:00	[thread overview]
Message-ID: <m3wvxll104.fsf@mheaney.ni.net> (raw)
In-Reply-To: 928083159.436.79@news.remarQ.com

"Vladimir Olensky" <vladimir_olensky@yahoo.com> writes:

> ----------------------------------
> --  Which is right here - GNAT or OA ?
> ---------------------------------

Both are, because the language doesn't specify what happens when you
try to deallocate an object on the stack.  Your code is erroneous.

 
> I mentioned about my simple user GB examples few months ago in GB
> thread but then I had no time to prepare them for open use.  Then
> there was nice article about smart pointers by Mathew Heaney
> describing the same issue and I did not feel like adding anything else
> to this subject.

My philosophy is to declare the type in such a way so that the user has
to use the type's allocator, and can't declare the object on the stack:

  type T (<>) is limited private;
 
  type T_Access is access all T;


  function New_T return T_Access;

  procedure Free (O : in out T_Access);

  procedure Op1 (O : access T);


Using this technique, the problem you describe cannot happen.









      parent reply	other threads:[~1999-06-03  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 A Duff
1999-06-08  0:00                   ` Robert Dewar
1999-06-07  0:00                     ` Keith Thompson
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                           ` Vladimir Olensky
1999-06-13  0:00                           ` swhalen
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
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 [this message]
replies disabled

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