comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Safety of the Booch Ada 95 Components
Date: 1999/12/13
Date: 1999-12-13T00:00:00+00:00	[thread overview]
Message-ID: <38552EED.B52E679B@averstar.com> (raw)
In-Reply-To: 1e2lds4.7trgj21rgj9i0N%herwin@gmu.edu

Harry Erwin wrote:
> ... I'm concerned that they may not be safe under self-assignment as
> well. Is there something about the Ada 95 standard that guarantees that
> there will be no aliasing of container args?

No.  On the other hand, self-assignment is always safe in Ada,
even if the type is controlled, because the "official" semantic model
is that there is an anonymous intermediary object created for
an assignment statement (see RM95 7.6(17)).  If a compiler "optimizes"
this away, it must not create problems with self-assignment.

The simplest way to avoid creating self-assignment problems is to take
advantage of RM95 7.6(19) which says self-assignment may be implemented as a 
no-op.  This permission, plus the ability to do slice-assignment either
left-to-right or right-to-left, means that there is never a need
for an intermediary object in an assignment (and our front end never 
creates one).  

From other responses, it sounds like GNAT uses this approach as well.
But whatever (non-buggy ;-) approach the compiler uses, self-assignment is always safe in Ada.

> Harry Erwin, PhD, <http://mason.gmu.edu/~herwin>

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




      parent reply	other threads:[~1999-12-13  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10  0:00 Safety of the Booch Ada 95 Components Harry Erwin
1999-12-10  0:00 ` Matthew Heaney
1999-12-10  0:00   ` Harry Erwin
1999-12-12  0:00     ` Simon Wright
1999-12-12  0:00       ` Harry Erwin
1999-12-13  0:00         ` Simon Wright
1999-12-10  0:00   ` Hyman Rosen
1999-12-10  0:00     ` Matthew Heaney
1999-12-11  0:00       ` Harry Erwin
1999-12-12  0:00         ` Robert Dewar
1999-12-12  0:00           ` Harry Erwin
1999-12-13  0:00           ` Kent Paul Dolan
1999-12-13  0:00             ` Simon Wright
1999-12-13  0:00             ` Ted Dennison
1999-12-13  0:00             ` Robert I. Eachus
1999-12-13  0:00       ` Hyman Rosen
1999-12-13  0:00         ` Robert I. Eachus
1999-12-14  0:00           ` Simon Wright
1999-12-15  0:00             ` Harry Erwin
1999-12-15  0:00             ` Mats Weber
1999-12-17  0:00               ` Simon Wright
1999-12-14  0:00         ` Matthew Heaney
1999-12-10  0:00     ` Harry Erwin
1999-12-10  0:00 ` Simon Wright
1999-12-12  0:00   ` Simon Wright
1999-12-12  0:00     ` Matthew Heaney
1999-12-12  0:00   ` Harry Erwin
1999-12-13  0:00     ` Simon Wright
1999-12-13  0:00 ` Tucker Taft [this message]
replies disabled

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