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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-16 18:26:54 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F8F4559.50306@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: += in ada References: <3F7316F7.219F@mail.ru> <17cd177c.0310010606.52da88f3@posting.google.com> <3F8BC74F.2CFBFF37@0.0> <1066312000.671303@master.nyc.kbcfp.com> <1066322883.139702@master.nyc.kbcfp.com> <3F8F372D.9040801@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 17 Oct 2003 01:26:54 GMT NNTP-Posting-Host: 209.165.3.106 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1066354014 209.165.3.106 (Thu, 16 Oct 2003 18:26:54 PDT) NNTP-Posting-Date: Thu, 16 Oct 2003 18:26:54 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:1039 Date: 2003-10-17T01:26:54+00:00 List-Id: And don't forget to mention that 99% of applications will *never* notice the difference if a temoprary is created or not. Most things just simply are not so time-bound that a couple of extra microseconds (or is it nanoseconds these days? Picoseconds? Femptoseconds? Attoseconds? :-) burnt up in building and discarding some temporary - if in fact it does get created - are going to go totally unnoticed. And when we're getting main memory measured in *gigabytes* these days, can we really gripe about the space allocated? If the only thing at stake here is the relative efficiency between A += B and A := A + B then lets move on to something *really* interesting - like how waxing your car will gain you more fuel efficiency and save you Big Money at the gas pump every week. So tossing out efficiency as a concern, about all that is left is "style" to care about. Some folks may prefer staring at A += B rather than A := A + B - and such is their right. But many of us who grew up on Pascal, Fortran and Ada never found it to so wonderfully attractive that we just had to have it at any price. So we don't have any universal consensus that a) the "+=" if significantly more beautiful than the usual form, b) enough people find it to be so beautiful that Ada just *has* to go out there and implement it and c) once it makes it into the language the herds of C/C++/Java programmers will suddenly drop their opposition to Ada and get on board with the language. It just doesn't seem like its worth disrupting the compiler writers to get it in the language - or inconveniencing as many electrons as have been done in this thread over it. The difference between A += B and A := A + B doesn't amount to a warm bucket of spit. I'd suggest looking for where Ada has real shortcomings that need attention. MDC Robert I. Eachus wrote: > Hyman Rosen wrote: > >> In C++, I can say A += B, and then I don't need the temporary. If I >> say A = B + C, then I do. But Ada forces you to say A = A + b for the >> first >> case, and that gives you the temporary that you don't need. > > > Which makes Ada better for most common CPUs today, right? In a > processor with register renaming and OoO execution, which all Pentiums > since the Pentium Pro and all Celerons, Athlons, and Durons have, > register pressure can be caused by a lack of register names, but not > registers. So in (pseudo)code like > load R1,A > add R1,B > store R1,A > the CPU will actually use a pair of renaming registers to represent R1 > in this code fragment. And no matter whether you use the "Ada" approach > or the "C++" approach to defining the sequence, you will still use two > renaming registers and one register name to implement the code. (Oh, > and the time to execute the code will probably be dominated by the time > to fetch A and B if they are not already in registers or L1 cache.) > > Modern CPUs are so far from the finite state machines you may have been > taught about in some Assembler class that it isn't even funny. I > usually say that modern processors have lots of circutry devoted to > confusing anyone who tries to debug software using a debugger. The > problem is not just that the states you see in the debugger don't exist > when your code is running normally, no states corresponding to the ISA > exist when the processor is running normally. In fact, no states at all > exist when the processor is running. If you tell the processor to > create some sort of a state and push it on the stack it will do that. > Just remember that the state you see was manufactured this way because > you asked the processor to do so. -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m c o n d i c @ a c m . o r g "All reformers, however strict their social conscience, live in houses just as big as they can pay for." --Logan Pearsall Smith ======================================================================