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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,345a8b767542016e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-15 20:54:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr12.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <3c90af1e@news.starhub.net.sg> <3c91bfa3.1987537@news.demon.co.uk> <4a885870.0203152036.37c68e91@posting.google.com> Subject: Re: memory leakages with Ada? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: NNTP-Posting-Host: 208.191.177.131 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr12.news.prodigy.com 1016254425 ST000 208.191.177.131 (Fri, 15 Mar 2002 23:53:45 EST) NNTP-Posting-Date: Fri, 15 Mar 2002 23:53:45 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PAPDONFJVMQVPXJZDBNFXBBZ\LPCXLLBWLOOAFJYWZUYICD^RAQBKZQTZTX\_I[^G_KGFNON[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBM Date: Sat, 16 Mar 2002 04:53:46 GMT Xref: archiver1.google.com comp.lang.ada:21320 Date: 2002-03-16T04:53:46+00:00 List-Id: "Will" wrote in message news:4a885870.0203152036.37c68e91@posting.google.com... > "Pat Rogers" wrote in message news: > > Although there are several things I really like about C++, one of the things > > that I find shocking is that the programmer must remember to use a very slightly > > different syntax when calling delete on an allocated array, and that the other > > syntax will also compile and run -- and at the very least leak. (I understand > > the reason for this, don't bother to explain why; it still stinks!) That isn't > > the only such example, of course, but one that I find amazing. > > > > For example, the following is perfectly legal and wrong : > > > > char* p = new char[n]; > > delete p; > > > > I have to remember to say: > > > > delete[] p; > > Well, I remember Mr Stroustrup saying something to the effect that this is to > ease the job of the compiler writer. Looks to me more like a marketing decision > than a technical one. The reason is in fact technical. C++ cannot distinguish a single item from an array of them, so we have to tell the poor compiler which. Imagine what happens if p really does *not* designate an array... :-) > > I'm not saying Ada is perfect, so let's nobody start the language wars please, > > but Ada is clearly better in this regard. > > If I am paranoid about leaks, I would have used LISP :) :-)