From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64ced24a7e89252e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Unchecked deallocation question From: Jim Rogers References: <41A4AAFF.5060407@mailinator.com> <4540106.PdnsrBBvo5@linux1.krischik.com> <41a66926$0$25070$ba620e4c@news.skynet.be> User-Agent: Xnews/5.04.25 Message-ID: Date: Fri, 26 Nov 2004 04:05:02 GMT NNTP-Posting-Host: 12.73.183.134 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1101441902 12.73.183.134 (Fri, 26 Nov 2004 04:05:02 GMT) NNTP-Posting-Date: Fri, 26 Nov 2004 04:05:02 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:6493 Date: 2004-11-26T04:05:02+00:00 List-Id: Adrien Plisson 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