comp.lang.ada
 help / color / mirror / Atom feed
From: cjkywt@hotmail.com (Sergey)
Subject: Re: Unchecked deallocation question
Date: 26 Nov 2004 02:53:30 -0800
Date: 2004-11-26T02:53:30-08:00	[thread overview]
Message-ID: <c0630a89.0411260253.40576bbe@posting.google.com> (raw)
In-Reply-To: OXxpd.59698$7i4.57298@bgtnsc05-news.ops.worldnet.att.net

Jim Rogers <jimmaureenrogers@att.net> wrote in message news:<OXxpd.59698$7i4.57298@bgtnsc05-news.ops.worldnet.att.net>...
> Adrien Plisson <aplisson-news@stochastique.net> wrote in
> news:41a66926$0$25070$ba620e4c@news.skynet.be: 
> 
> > Martin Krischik wrote:
> >> You should carefully thing if you really need it. Unlike C/C++ the
> >> following is actually valid:
> >> 
> >> declare
> >>     It : Root'Class := Derived'(...);
> >> begin
> >>     ...
> >> end;
> > 
> > mmmm, i don't think there is any problem doing this in C++:
> > 
> > class Root;
> > class Derived : public Root;
> > 
> > Root &It = Derived( ... );
> > 
> > it just uses a reference type which is almost the same as ada access 
> > type but you cannot assign null to it and cannot dereference it.
> > 
> 
> This is a difference between C++ and Ada. The C++ solution uses
> dynamic memory allocation (from the free space or heap) while the
> Ada solution uses the stack. 

An example was posted by Adrien has nothing to do with dynamic memory
allocation. As you can see, Derived is allocated from the STACK.

>Use of the stack eliminates the need
> for explicit allocation and deallocation.
> 
> Jim Rogers



  reply	other threads:[~2004-11-26 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 15:38 Unchecked deallocation question Alex R. Mosteo
2004-11-24 17:24 ` Jeffrey Carter
2004-11-24 17:35   ` Alex R. Mosteo
2004-11-24 17:33 ` David Botton
2004-11-25  8:35 ` Martin Krischik
2004-11-25  9:12   ` Alex R. Mosteo
2004-11-25 23:24   ` Adrien Plisson
2004-11-26  4:05     ` Jim Rogers
2004-11-26 10:53       ` Sergey [this message]
2004-11-26  9:06     ` Dmitry A. Kazakov
2004-11-26 18:20       ` Sergey
2004-11-27  8:43         ` Dmitry A. Kazakov
replies disabled

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