comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Flexible Strings (was Equality operator...)
Date: 1997/05/04
Date: 1997-05-04T00:00:00+00:00	[thread overview]
Message-ID: <dewar.862755569@merv> (raw)
In-Reply-To: F8EE9AADC9C36923.41A42DC23ED785AA.CE3497CD89914525@library-proxy.airnews.net


Kevin Cline said

<<Evidently it wasn't important enough for the standard to mandate any useful
semantics for unchecked_deallocation.>>

That shows a misunderstanding of language semantics. There is no easy way
to formalize what it means to free storage that would encompass all possible
dynamic allocation techiques, including effects of fragmentation etc.

For example, if we try to define that certain classes of programs should
run for ever without getting storage error, then it is still a semantically
valid implementation to just use up virtual memory for ever (if necessary
asking for new tapes to be loaded to store the old junk).

So no language standard can meaninfuly specify formal semantiocs for
what deallocation might mean, beyond specifying that reference to freed
storage is in an appropriate sense incorrect.

So Ada is no different from C or Pascal or any other lanuage here. I suspect
that Kevin is not the kind of person who spends his time studying formal
standards, but if you want to follow this up, for example go look at the
definition of Dispose in the ANSI Pascal standard.

What does the Ada standard say about Unchecked_Deallocation:

    9  Free(X), when X is not equal to null first performs finalization,
       as described in 7.6.  It then deallocates the storage occupied by
       the object designated by X. If the storage pool is a user-defined


Nice, but of course deallocate is not really formally defined, then we have
the implementation advice:

17   For a standard storage pool, Free should actually reclaim the storage.

again "actually reclaim" is not formally defined.

BUT, does this matter in practice? Of course not, all Ada compilers always
have followed this advice for the standard storage pool, and it would be
surprising if it were otherwise. This is exactly the same situation as
observing that all C compilers actualy free storage when free is used.

Is it possible to make a formally conforming implementation in which
unchecked deallocation is useless. Most certainly. It is also possible
to make a formally conforming impl,ementation in which all integr
additions take one hour to complete. Bothy implementations are formally
correct according to the standard, both are totally useless!





  reply	other threads:[~1997-05-04  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     ` Robert Dewar
1997-05-04  0:00       ` Kevin Cline
1997-05-04  0:00         ` Robert Dewar [this message]
1997-05-06  0:00           ` Kaz Kylheku
1997-05-07  0:00             ` Robert Dewar
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
1997-05-07  0:00               ` Robert Dewar
1997-05-08  0:00               ` Robert I. Eachus
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
1997-05-03  0:00     ` Jon S Anthony
     [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