From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Please Help.
Date: 1997/09/17
Date: 1997-09-17T00:00:00+00:00 [thread overview]
Message-ID: <342005BE.5C4E@gsfc.nasa.gov> (raw)
In-Reply-To: dewar.874434176@merv
Robert Dewar wrote:
>
> Stephe said:
>
> <<Excellent point, which I missed. It is definitely more important to
> learn the fundamentals. On the other hand, if your learning control
> structures, and you want to print a diagnostic message that is built
> from several strings, Unbounded_Strings are nice.>>
>
> What's wrong with Put_Line ("value of x is " & Integer'Image (X) & ....) ..
Ummm, nothing. I've been doing too much C++ lately, where such things
are not
available, and I have to use dynamic strings for this purpose. I guess I
was
thinking of that, not of the One True Way. Sigh.
>
> <<As I thought. So Dale (if you're still reading :), will you be pointing
> out that using Unbounded_String does have a big downside? When you get
> to teaching about dynamic memory allocation and managment, you could
> point out that they've been doing it all along without thinking about
> it, just like a lot of professional programmers!.>>
>
> What big downside? What's wrong with using Controlled types here, it is
> certainly the intended and expected implementation!
The downside is heap fragmentation, which will bite you just when it
costs the most to fix. Controlled types can guarantee no dangling
pointers; they do not guarantee no heap fragmentation. For that you need
compacting storage pools (or very careful use of Unbounded_Strings).
Is there a requirement in Ada 95 to document whether the
Unbounded_Strings implementation is compacting? This would be useful
information; I haven't seen it in Annex M for ObjectAda, but I don't
believe I've read the whole thing.
--
- Stephe
next prev parent reply other threads:[~1997-09-17 0:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-09-09 0:00 Please Help Ken
1997-09-09 0:00 ` Stephen Leake
1997-09-09 0:00 ` Dale Stanbrough
1997-09-11 0:00 ` Robert Dewar
1997-09-12 0:00 ` Tristan Ludowyk
1997-09-12 0:00 ` Dale Stanbrough
1997-09-12 0:00 ` Stephen Leake
1997-09-13 0:00 ` Robert Dewar
1997-09-15 0:00 ` Stephen Leake
1997-09-15 0:00 ` Dale Stanbrough
1997-09-16 0:00 ` Robert Dewar
1997-09-17 0:00 ` Stephen Leake [this message]
1997-09-18 0:00 ` Robert Dewar
1997-09-19 0:00 ` Stephen Leake
1997-09-19 0:00 ` Robert S. White
1997-09-20 0:00 ` Robert Dewar
1997-09-12 0:00 ` Robert Dewar
1997-09-13 0:00 ` Matthew Heaney
1997-09-13 0:00 ` Dale Stanbrough
1997-09-15 0:00 ` Richard A. O'Keefe
1997-09-16 0:00 ` Robert Dewar
-- strict thread matches above, loose matches on Subject: below --
2001-10-25 6:55 please help Phosphorus
2001-10-25 8:22 ` Preben Randhol
2001-10-25 12:35 ` Marc A. Criley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox