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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-18 20:04:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? Date: 18 Jun 2002 20:04:37 -0700 Organization: http://groups.google.com/ Message-ID: References: <3d0ce154_5@news.bluewin.ch> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1024455877 26441 127.0.0.1 (19 Jun 2002 03:04:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 19 Jun 2002 03:04:37 GMT Xref: archiver1.google.com comp.lang.ada:26343 Date: 2002-06-19T03:04:37+00:00 List-Id: "chris.danx" wrote in message news:... > "Russ" <18k11tm001@sneakemail.com> wrote in message > news:bebbba07.0206172212.4bc5cc3a@posting.google.com... > > > > By the way, it's too bad that Ada wasted "/=" on "not equals. It would > > be very useful for dividing a matrix by a scalar. For example, the > > construct > > > > A := A / 2.0; > > > > is very inefficient because a temporary matrix must be created to > > store A/2, then an assignment must be used to put the result back in > > A. On the other hand, > > the construct > > > > A /= 2.0 > > > > is not only much cleaner looking, it is much more efficient because > > you can skip the temporary matrix and the assignment. And please don't > > argue with me here, because you will only be showing your ignorance. > > Good C++ programmers know all about this. > > I'm not going to argue with you (you've made up your mind and so have I, > what's the point?), I'm just curious as to whether compilers would see A := > A / 2 and think "that code's dividing the matrix by 2 and assigning it to > itself. It might be better just to divide it inplace" leading to the same > thing. But then I'm largely ignorant of compilers. The short answer is no. It cannot be done by the compiler. (If you don't believe me, go ahead and chase your tail for a while.) However, it could be done by a specialized pre-processor. There was talk of adding something like that to C++ a while back, just so that people could write more elegant code, such as A = B + C and have it automatically converted to the less attractive but more efficient form A = B A += C I don't know if it ever went anywhere, but it does show that C++ programmers are well aware of these issues.