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,1d321b3a6b8bcab2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-30 07:33:19 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!EU.net!sun4nl!baby!martijn From: martijn@and.nl (Martijn Bak) Subject: Ada vs. C Message-ID: Organization: AND Software B.V., Rotterdam References: <3fnf28$s3f@Starbase.NeoSoft.COM> <3frqpg$re5@cronkite.seas.gwu.edu> <3g655n$q5k@theopolis.orl.mmc.com> Date: Mon, 30 Jan 1995 15:33:19 GMT Date: 1995-01-30T15:33:19+00:00 List-Id: >It all falls out of the design of the language. Constructs like "+=" >provide no benifit other than to save typing within a single >statement. Take the statement: > > Principle = Principle + (Interest * Time) > >The "+=" operator is MADE for this statement, but its ONLY benifit is >to save me 11 characters in my source file. Nope, in general this is _not_ true! The statements expr1 += expr2; and expr1 = expr1 + expr2; are _not_ the same. In the former, expr1 is evaluated only once, in the latter expr1 is evaluated twice. This is not only a matter of execution speed. It is especially important if expr1 has side-effects. There is also a conceptual benefit for the += (if expr1 is very complex). Compare a[i->j(q,b)] = a[i->j(q,b)] + 2; and a[i->j(q,b)] += 2; In the latter case, neither the writer nor the reader of this code need to check whether a[i->j(q,b)] and a[i->j(q,b)] realy are the same. Yep, I _am_ a C programmer. -- -- Martijn Bak -- AND Software -- Westersingel 108, 3015 LD Rotterdam -- -- tel: +31-10-4367100 -- fax: +31-10-4367110 -- email: martijn@and.nl --