From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8acd4291c317f897 X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Safety of the Booch Ada 95 Components Date: 1999/12/13 Message-ID: <38552EED.B52E679B@averstar.com>#1/1 X-Deja-AN: 560158236 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <1e2lds4.7trgj21rgj9i0N%herwin@gmu.edu> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-12-13T00:00:00+00:00 List-Id: 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, -- -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