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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e7d9fee9b42cd34e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newspeer.monmouth.com!newsgate.cistron.nl!xs4all!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Not null feature with anonymous and named access types Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1150144396.104055.164310@f6g2000cwb.googlegroups.com> <6_kjg.4603$E02.1474@newsb.telia.net> <1150154013.951160.154270@j55g2000cwa.googlegroups.com> <15d5p0cbyr817.1vzzowtu2dayj$.dlg@40tude.net> <1150212476.630345.297100@c74g2000cwc.googlegroups.com> <4fana1F1i8fppU1@individual.net> <1150299433.315551.41490@g10g2000cwb.googlegroups.com> <18lx513zr1o49.lpffjwx41xi4.dlg@40tude.net> <1150343308.372654.225640@f6g2000cwb.googlegroups.com> Date: Thu, 15 Jun 2006 10:21:34 +0200 Message-ID: <1xjx7454hmql7.14ype2u114tz2.dlg@40tude.net> NNTP-Posting-Date: 15 Jun 2006 10:21:28 MEST NNTP-Posting-Host: 4b37f52f.newsread2.arcor-online.net X-Trace: DXC=9A[oCGUocG3E][lTbkER26Q5U85hF6f;4jW\KbG]kaM8[NGU2GAcMG:o On 14 Jun 2006 20:48:28 -0700, Anh Vo wrote: > Dmitry A. Kazakov wrote: >> On 14 Jun 2006 08:37:13 -0700, Anh Vo wrote: >> >> via *this* pointer, which does not mean that it cannot be reclaimed at all. >> Consider trivial stack allocated aliased variable. > > I am afraid I do not understand "this* pointer means. You can have many pointers and other references to the same memory. > What I was > talking about not null access object using heap memory, not aliased > variable at all. See my code snipet from my original post. That's no problem. You just shouldn't mix referencing objects and memory management. Not-null access types aren't intended for memory management. So your example is flawed [*]. >> No, you just don't use not-null pointers where deallocation is possible / >> necessary. That's the very idea of not-null pointers. > > I weight memory leak more important than convenient way of using null > excluded pointer. I am fine with not null pointer pointing to an > aliased object. In this case, attemptingp to deallocate the pointer is > clearly a language violation. But an aliased object, in a wider sense, that you have a more than one reference to it, is the only case where non-null pointer should be used! -------------- * There is a language design problem that not-null is a subtype constraint rather than a type, so Ada.Unchecked_Deallocation cannot reject instantiation with a not-null pointer, as it probably should. But that is a problem of generics, not of null-pointers. But this is another story. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de