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-18 08:06:21 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!msc1.onvoy!ply1.onvoy!upp1.onvoy!onvoy.com!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!world!news From: Robert A Duff Subject: Re: status of Ada STL? Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 18 Jun 2002 15:05:43 GMT References: <3d0ce154_5@news.bluewin.ch> <3d0e574d_2@news.bluewin.ch> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:26246 Date: 2002-06-18T15:05:43+00:00 List-Id: Vinzent Hoefler writes: > 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. > > Every good compiler should see in its data flow analysis that both > statements simply are the same. It *should* not be a matter of how it > is *expressed*. So, what am I missing? 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. (Whether you call it "+" or F or Add_Vector is irrelevant to the optimization issue.) - Bob