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,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-17 23:48:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: "Mark A. Biggar" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <3F650BBE.4080107@attbi.com> <3F67AAC6.2000906@attbi.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.235.88.213 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc51.ops.asp.att.net 1063867688 12.235.88.213 (Thu, 18 Sep 2003 06:48:08 GMT) NNTP-Posting-Date: Thu, 18 Sep 2003 06:48:08 GMT Organization: Comcast Online Date: Thu, 18 Sep 2003 06:48:08 GMT Xref: archiver1.google.com comp.lang.ada:42650 Date: 2003-09-18T06:48:08+00:00 List-Id: Martin Dowie wrote: > "Russ" <18k11tm001@sneakemail.com> wrote in message > news:bebbba07.0309171110.192b565c@posting.google.com... > >>In the previous thread, someone claimed that "+=" needs a temporary >>too for some sort of overflow checking (I don't recall the exact >>reason given). If that is true, then it is an example of an inherent >>inefficiency built in to Ada. For better or worse, C++ has no such >>inefficiency. (I'm just stating a fact, I am *not* claiming that C++ >>did it right.) > > > And Ada will not have this "inefficiency" if _you_ select to remove the > checks. The difference is that you do it _explicitly_ in Ada. > > To have equivilent code in C++ if would have to hand-write the > check and then throw the exception. > You may or may not be able to turn this off. The problem is that the Ada LRM says that on any assignment if an exception is raised when evaluating the RHS then the LHS shall be left unchanged. So unless the compiler can determine that no such exception is possible it has to use a temporary. This of course is yet another instance of solving the halting problem in the general case. Now. as Ada doesn't currently have ops like += they could be add to the language in such a way to not abide by the above rule. But, that would break the semantic equavalence between "A := A + B;" and "A += B;". It also gets all messed up with issues involving user defined ops and controlled types. -- mark@biggar.org mark.a.biggar@comcast.net