comp.lang.ada
 help / color / mirror / Atom feed
From: DPH <rally2xs@compuserve.com>
Subject: Re: memory leakages with Ada?
Date: Sat, 16 Mar 2002 09:56:41 -0500
Date: 2002-03-16T14:56:25+00:00	[thread overview]
Message-ID: <3pm69u85j4h7efndahkean6trom5utk21m@4ax.com> (raw)
In-Reply-To: INIk8.12175$2V5.2924986477@newssvr11.news.prodigy.com

On Sat, 16 Mar 2002 14:38:32 GMT, "Pat Rogers" <progers@classwide.com>
wrote:

>"DPH" <rally2xs@compuserve.com> wrote in message
>news:s3369uo70srjh7m4pjkgt6n4kpt88hdeb8@4ax.com...
>> On Fri, 15 Mar 2002 12:55:19 GMT, "Pat Rogers" <progers@classwide.com>
>> wrote:
>>
>> >"John McCabe" <john.mccabe@emrad.ns.com> wrote in message
>> >news:3c91bfa3.1987537@news.demon.co.uk...
>> >> On Thu, 14 Mar 2002 15:12:21 -0500, "Marin David Condic"
>> >> <dont.bother.mcondic.auntie.spam@[acm.org> wrote:
>> >>
>> >> >In comparing Ada to C on this there are two observations: One is that Ada
>> >> >provides a different model for dynamic allocation than does C that
>includes,
>> >> >among other things, a lot more checks/safety features to minimize the
>> >> >possibility of lost memory. (Still, the standard doesn't require garbage
>> >> >collection so you can still leak memory if you mess things up.) It isn't
>> >> >impossible to leak memory in Ada - just less likely.
>> >>
>> >> One of the things I've found recently, since starting to use C++ more,
>> >> is that Ada.UncheckedDeallocation is so much nicer than 'delete' as it
>> >> returns you a nice, null pointer! 'delete' in C++ appears to remove
>> >> the allocated block, but leave your pointer pointing to where it used
>> >> to be!
>> >
>> >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;
>>
>> No you don't... you just write it with Borland C++ Builder 5 or better
>> with CodeGuard turned on, and CodeGuard will complain about it all
>> over the place.
>
>But then why can't the compiler do that?
>

Well, they _could_ build it in if they wanted to, and since its part
of the IDE it might be said to be part of the compiler already, but
this goes back to a post I made last month.  I'm just wondering if Ada
is all that much less error prone when you start comparing it with C++
development environments in the wildly popular platforms of Windows
and Linux, but especially windows.  There are just scads of tools to
do about everything (except reliably find the memory leaks of C++,
although there may be - and I just haven't run across it yet) and
those tools are generally cheaper due to economy of scale.  

Don't get me wrong - I love Ada - but cheap and plentiful tools for
other languages count for something, too.  Couple that with being able
to find 10 - 20 C++ programmers for every Ada programmer, and Ada
loses a lot of business.

Dave Head



  reply	other threads:[~2002-03-16 14:56 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-14 14:07 memory leakages with Ada? Calvin Ow
2002-03-14 14:31 ` Larry Kilgallen
2002-03-14 20:42   ` Nick Roberts
2002-03-14 21:11     ` Larry Kilgallen
2002-03-14 21:07   ` Anh_Vo
2002-03-14 20:12 ` Marin David Condic
2002-03-15  9:37   ` John McCabe
2002-03-15 12:55     ` Pat Rogers
2002-03-16  4:36       ` Will
2002-03-16  4:53         ` Pat Rogers
2002-03-16 12:21         ` Larry Kilgallen
2002-03-16  9:13       ` DPH
2002-03-16 14:38         ` Pat Rogers
2002-03-16 14:56           ` DPH [this message]
2002-03-16 15:51             ` Preben Randhol
2002-03-16 16:39               ` DPH
2002-03-16 19:51                 ` Pat Rogers
2002-03-16 20:40                   ` DPH
2002-03-17 19:31                   ` Richard Riehle
2002-03-17 21:49                     ` Pat Rogers
2002-03-17 22:02                       ` Pat Rogers
2002-03-18 22:32                         ` Randy Brukardt
2002-03-18 22:47                           ` Pat Rogers
2002-03-18  7:22                       ` Richard Riehle
2002-03-18 17:35                     ` Marin David Condic
2002-03-17 16:26                 ` Steve Doiel
2002-03-16 20:18         ` Robert A Duff
2002-03-16 20:36           ` DPH
2002-03-15 14:20     ` Marin David Condic
2002-03-18 17:54       ` Warren W. Gay VE3WWG
2002-03-18 19:54         ` Hyman Rosen
2002-03-18 20:34           ` Larry Kilgallen
2002-03-18 21:18             ` Hyman Rosen
2002-03-18 21:45               ` Larry Kilgallen
2002-03-20  1:19                 ` Hyman Rosen
2002-03-20 17:06                   ` Warren W. Gay VE3WWG
2002-03-20 17:56                     ` Larry Kilgallen
2002-03-20 17:48                   ` Marin David Condic
2002-03-22  0:25               ` Matthew Woodcraft
2002-03-22  5:10                 ` Hyman Rosen
2002-03-18 22:18         ` Marin David Condic
2002-03-20 20:49         ` Bertrand Augereau
2002-03-21  4:31         ` Will
2002-03-15 16:00     ` Hyman Rosen
2002-03-15 21:59       ` Chad R. Meiners
2002-03-17  5:43         ` Kevin Cline
2002-03-17  7:22           ` Chad R. Meiners
2002-03-18  4:09             ` Kevin Cline
2002-03-18 16:54               ` Chad R. Meiners
2002-03-18 17:38             ` Warren W. Gay VE3WWG
2002-03-19  9:21               ` John McCabe
2002-03-19 17:11                 ` Warren W. Gay VE3WWG
2002-03-19 17:16                   ` Pat Rogers
2002-03-19 17:51                   ` David C. Hoos
2002-03-19 18:20                   ` Frank J. Lhota
2002-03-19 23:43                     ` Mark Johnson
2002-03-20 15:09                       ` Frank J. Lhota
2002-03-17  7:27           ` Hyman Rosen
2002-03-18  3:52             ` Kevin Cline
2002-03-18  5:37               ` Hyman Rosen
2002-03-15 17:41   ` Kevin Cline
2002-03-15 18:00     ` Marin David Condic
2002-03-15 18:08     ` Hyman Rosen
2002-03-16 10:15       ` Kevin Cline
2002-03-14 23:14 ` Kevin Cline
2002-03-15  3:20 ` Steve Doiel
2002-03-15  9:32   ` John McCabe
2002-03-15 15:46     ` Hyman Rosen
2002-03-15 17:29     ` Kevin Cline
2002-03-15 15:48   ` Jeffrey Carter
2002-03-16  3:05     ` Steve Doiel
2002-03-16 20:19       ` Jeffrey Carter
2002-03-15 17:25   ` Kevin Cline
2002-03-15 18:03     ` Hyman Rosen
2002-03-16 10:07       ` Kevin Cline
2002-03-17  3:00         ` Hyman Rosen
2002-03-15  9:27 ` John McCabe
  -- strict thread matches above, loose matches on Subject: below --
2002-03-20  6:25 Christoph Grein
2002-03-20 16:35 ` Hyman Rosen
replies disabled

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