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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-16 14:53:35 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: += in ada Date: 16 Oct 2003 14:53:34 -0700 Organization: http://groups.google.com Message-ID: References: <3F7316F7.219F@mail.ru> <17cd177c.0310010606.52da88f3@posting.google.com> <3F8BC74F.2CFBFF37@0.0> <1066312000.671303@master.nyc.kbcfp.com> NNTP-Posting-Host: 128.102.146.44 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1066341215 2889 127.0.0.1 (16 Oct 2003 21:53:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Oct 2003 21:53:35 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:1023 Date: 2003-10-16T14:53:34-07:00 List-Id: "Mark A. Biggar" wrote in message news:... > Hyman Rosen wrote: > > > Lutz Donnerhacke wrote: > > > >> * Russ wrote: > >> > >>> Actually, a competent programmer will define the "+" operator in terms > >>> of the ":+" operator rather than vice versa, because the ":+" is > >>> usually more efficient (since it has no need for temporaries and extra > >>> copying). > >> > >> > >> Wrong. > > > > > > That's certainly the way it's usually done in C++, > > for exactly the reason stated, so a bald "wrong" is > > not terribly enlightening. > > > > Okay, show how to define "+" in terms of "+=" with out explicitly > reintroducing the temp variable you were so hot to eliminate? When you define "+" in terms of "+=" you reintroduce the temp, of course. The point is that you then have the option of using "+=", which is more efficient, or "+", which is a bit more elegant. Also, "+" can be "cascaded", as in "A = B + C + D", but "+=" cannot (you need A=B; A+=C; A+=D).