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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-04 05:51:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!feed2.newsreader.com!newsreader.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!uunet!ash.uu.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 04 Jun 2003 08:51:32 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3ED4F3FD.A0EF7079@alfred-hilscher.de> <6vWcnTWjF83bD0qjXTWcpA@gbronline.com> <3EDCBDF4.1050900@attbi.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1054731092 14964 199.172.62.241 (4 Jun 2003 12:51:32 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 4 Jun 2003 12:51:32 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:38590 Date: 2003-06-04T08:51:32-04:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: > But Mr. Duff says that "+=" is just "syntactic sugar" for "Add(A,B)," > and Mr. Eachus says "+=" needs a temporary to preserve A in the case > of a Constraint_Error. So, as far as efficiency is concerned, we're > screwed either way, aren't we? Robert Eachus and I have had that argument before, and I don't really feel like having it again, but for the record: I disagree with Robert. I believe the wording of RM-11.6 allows the left-hand side of an assignment to be destroyed in the presence of Constraint_Error. I also believe that was the *intent* of 11.6. (I know something about the intent, I think, since Tucker and I spent days wrestling with the wording.) For example: type T is range 1..10; X: T := 10; X := X + 1; If X is in register R1, then the compiler can generate machine code like: Add R1+1, putting the result in R1. Check that R1 in 1..10, and raise C_E if not. thus leaving the junk value 11 in X (i.e. R1). This is true even if an exception handler can see X. The semantics described by Robert Eachus is correct for Ada 83, but it was deliberately changed for Ada 95, to make the language more competitive with other languages in terms of efficiency. The moral of the story is: If you handle predefined exceptions, you are playing with fire. - Bob