comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@att.net>
Subject: Re: Unchecked deallocation question
Date: Fri, 26 Nov 2004 04:05:02 GMT
Date: 2004-11-26T04:05:02+00:00	[thread overview]
Message-ID: <OXxpd.59698$7i4.57298@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: 41a66926$0$25070$ba620e4c@news.skynet.be

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. Use of the stack eliminates the need
for explicit allocation and deallocation.

Jim Rogers




  reply	other threads:[~2004-11-26  4:05 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 [this message]
2004-11-26 10:53       ` Sergey
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