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,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-19 05:40:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? Date: Wed, 19 Jun 2002 14:45:34 +0200 Message-ID: References: <3d0ce154_5@news.bluewin.ch> <3d0e574d_2@news.bluewin.ch> <3d0fb5e8$1_3@news.bluewin.ch> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1024490406 9578731 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:26373 Date: 2002-06-19T14:45:34+02:00 List-Id: On Wed, 19 Jun 2002 00:36:20 +0200, Vinzent Hoefler wrote: >Robert A Duff wrote: > >>> 18k11tm001@sneakemail.com (Russ) wrote: >>> >Every good C++ programmer knows that "+=" is much more efficient than >>> >"+" for vector/matrix addition because it eliminates the need for >>> >constructing a temporary matrix to hold the sum. > >[...] > >>I think Russ is right here. >> >>X := F(X, Y); >> >>is *not* equivalent to the code that overwrites X in place, >>in the general case. In the usual case, where the called function >>is not inlined, and the compiler doesn't look at its body, >>the compiler has no hope of doing this optimization. >>Even if it's inlined, the proof is not trivial. > >Hmm, well. Seems I did not take a closer look on what operator >overloading can do. I still thought of simple C. :( > >Anyway, I could declare F (X : inout ...; Y); then, to do the >assignment for me. ;-) Yes, but it would be nice to have an operator equivalent for that: procedure "+:=" (Accum : inout A; Argument : A); I think it would be relatively easy to add some extra keywords like "+:=", "-:=" etc. They should have no priorities and one need not predefine them for any type. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de