comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Flexible Strings (was Equality operator...)
Date: 1997/05/07
Date: 1997-05-07T00:00:00+00:00	[thread overview]
Message-ID: <E9sAq2.HE8@world.std.com> (raw)
In-Reply-To: 5kocg6$hln@bcrkh13.bnr.ca


In article <5kocg6$hln@bcrkh13.bnr.ca>,
Kaz Kylheku <kaz@vision.crest.nt.com> wrote:
>But the C standard firmly says that ``The free function causes the space
>pointed to by ptr to be deallocated, that is, made available for further
>allocation'' (ISO 9899:1990 7.10.3.2 The free function). This pretty much
>constitutes a requirement that the C implementation actually deallocate
>when free is called, which carries more weight than a mere observation
>about what all existing implementations do.

It *sounds* firm, but it isn't really saying anything precise.  For
example, it doesn't address the issue of fragmentation.  If I deallocate
1000 objects of size 100 bytes each, does that mean I can now allocate a
single 100,000-byte object in that space?  After all, it says that
storage is "available for allocation".  Do you interpret this
requirement to require compaction of storage?  Sure sounds like it, but
that surely wasn't the intent.

Can you write a test program that detects the difference between a C
implementation that obeys the above "requirement", and one that doesn't?
If not, then it should be viewed merely as Implementation Advice, from a
formal point of view.

Of course, I admit that the C standard is easier to understand on this
particular point, if you're just a programmer trying to write programs,
and not a language lawyer.  The Ada standard goes out of its way to
raise questions of this nature, unfortunately.  Nonetheless, I claim
that the requirements of C and Ada are identical with respect to whether
free/Unch_Dealloc must/should reclaim storage.  They're just written in
a different style.

- Bob




  parent reply	other threads:[~1997-05-07  0:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-30  0:00 Flexible Strings (was Equality operator...) W. Wesley Groleau (Wes)
1997-04-30  0:00 ` Matthew Heaney
1997-05-01  0:00   ` Robert Dewar
1997-05-02  0:00   ` Kevin Cline
1997-05-03  0:00     ` Jon S Anthony
1997-05-03  0:00     ` Robert Dewar
1997-05-04  0:00       ` Kevin Cline
1997-05-04  0:00         ` Robert Dewar
1997-05-06  0:00           ` Kaz Kylheku
1997-05-07  0:00             ` Kevin Cline
1997-05-07  0:00               ` Robert A Duff
1997-05-07  0:00               ` Matthew Heaney
1997-05-07  0:00                 ` Jon S Anthony
1997-05-07  0:00               ` Robert Dewar
1997-05-07  0:00               ` Jon S Anthony
1997-05-07  0:00             ` Robert Dewar
1997-05-07  0:00             ` Robert A Duff [this message]
1997-05-07  0:00               ` Robert Dewar
1997-05-08  0:00               ` Robert I. Eachus
1997-05-07  0:00             ` Robert Dewar
1997-05-09  0:00           ` Erik Magnuson
1997-05-10  0:00             ` Robert Dewar
1997-05-10  0:00               ` Matthew Heaney
1997-05-10  0:00             ` John G. Volan
1997-05-10  0:00               ` Robert Dewar
1997-05-10  0:00                 ` Matthew Heaney
1997-05-11  0:00                   ` Robert Dewar
1997-05-12  0:00               ` Erik Magnuson
     [not found] <199705010554.WAA24507@ni1.ni.net>
1997-05-01  0:00 ` W. Wesley Groleau (Wes)
1997-05-02  0:00   ` Robert Dewar
replies disabled

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