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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,10444cff97404845 X-Google-Attributes: gid103376,public From: Andi Kleen Subject: Re: C like op= proposal Date: 1999/08/17 Message-ID: #1/1 X-Deja-AN: 513930319 References: <37B7D172.DCE02FFA@Maths.UniNe.CH> <87emh2l218.fsf@antinea.enst.fr> Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@fred.muc.de X-Trace: fred.muc.de 934915493 1560 127.0.0.1 (17 Aug 1999 18:44:53 GMT) Organization: barely any Mime-Version: 1.0 User-Agent: Gnus/5.070095 (Pterodactyl Gnus v0.95) Emacs/20.4 NNTP-Posting-Date: 17 Aug 1999 18:44:53 GMT Newsgroups: comp.lang.ada Date: 1999-08-17T18:44:53+00:00 List-Id: Samuel Tardieu writes: > >>>>> "Gautier" == Gautier writes: > > Gautier> a(b(c,d+e(f,g)).h(i,j)) := a(b(c,d+e(f,g)).h(i,j)) + 1; > > Gautier> which can be horribily long and unlikely to be catched by the > Gautier> optimizer -> 2x too slow (at least: the extra code makes a > Gautier> penalty for processor cache). > > Where did you get the impression that the optimizer would miss this? [..] discussion about +=,++ and friends for better code snipped. I would like to have += in Ada (perhaps not ++,--) simply because it is more expressive. My brain wraps easier to "increase X by Y" than to "set X to the sum of X and Y"[1] Ada is about making it easy for the reader, isn't it? +=, -= make it clear that there is a side effect that takes the old value into account, with the spelled out way "x := x + 1" I have to determine that first. With simple "x" it is easy, but e.g. with Gautier's example above it requires real mental work that distracts me from my primary job. Not that this is impossible, it is just that the first way is IMHO better readable because it makes the intent of the author more clear. -Andi [1] To attribute correctly this is an old argument from, I believe Dennis Ritchie, in a prehistoric article about C. I think he's right. -- This is like TV. I don't like TV.