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-16 17:31:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3F67AAC6.2000906@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc51.ops.asp.att.net 1063758564 24.34.139.183 (Wed, 17 Sep 2003 00:29:24 GMT) NNTP-Posting-Date: Wed, 17 Sep 2003 00:29:24 GMT Organization: Comcast Online Date: Wed, 17 Sep 2003 00:29:25 GMT Xref: archiver1.google.com comp.lang.ada:42589 Date: 2003-09-17T00:29:25+00:00 List-Id: Wes Groleau wrote: > Interesting how you were not able to persuade any of us ignoramuses > that temporaries are always needed without it nor that they are never > needed with it. Let me tell you a story with names removed because I don't want to seem to be dissing any company or compiler--because in this case the reality was just the opposite. A woman, who was a fairly well respected compiler expert called me for advice. She was implementing an Ada compiler for a vector machine, and was concerned that as she read the rules, Ada required copying the arguments in cases where Fortran 90 did not. I gave her a few lines of Fortran over the phone. She said, yes, that is exactly an example of what I am talking about. Okay, I said, go compile it, run it, and look at the results... After lunch she called me back. "As you must have expected, our Fortran compiler produced garbage." "Yep, and I can give you chapter and verse from the Fortran standard where it says that case is not erroneous." "No need, I can do that myself. Do I need to fix the Fortran compiler to make copies of vectors in all the cases that Ada requires them?" "Nope, if you look at the wording carefully, all that both languages require is that you get the right answer. It is just a little more obvious in Ada that sometimes that requires an 'extra' copy." She fixed her Fortran compiler, and also validated her Ada compiler. But let me explain why she had problems. On a vector machine, the hardware can step through an array with a "stride" set to more than one. In other words extract a vector from a 2 dimensional, or even n-dimensional array. But in both Ada and Fortran you can store the result of that computation in the same array. Now imagine a case where the vector machine grabs more than one value--this one took 8 byte chuncks so a single precison array would do. But for the code I suggested the vector engine wrote back the modified eight-byte value with the second half modified, just after writing the first four bytes. The hardware couldn't guarantee that the two writes would occur in any particular order, and in practice they didn't. Both Ada and Fortran were willing to allow her not to use temporaries, as long as the compiler could verify that this particular gotcha didn't occur. -- Robert I. Eachus "As far as I'm concerned, war always means failure." -- Jacques Chirac, President of France "As far as France is concerned, you're right." -- Rush Limbaugh