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: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: Tim Behrendsen Subject: Re: C is 'better' than Ada because... Date: 1996/08/06 Message-ID: #1/1 X-Deja-AN: 172557882 references: <9608061851.AA17508@camo.brc.shell.com> content-type: TEXT/PLAIN; charset=US-ASCII organization: InterNex Information Services 1-800-595-3333 mime-version: 1.0 newsgroups: comp.lang.c,comp.lang.ada Date: 1996-08-06T00:00:00+00:00 List-Id: On Tue, 6 Aug 1996, Richard G. Hash wrote: > In comp.lang.ada you write: > > if ((array[++n] = GetValue(arg)) != 0) { > > .... > > v.s. a typical non-C language ... > > > > n = n + 1; > > array[n] = GetValue(arg); > > if (array[n] != 0) { > > ... > > } > > Now, which is easier to optimize? (more snip) > > Do you actually use a modern C compiler that optimizes these two > constructs differently? I've used recent C compilers on half a dozen > platforms, and find it really difficult to believe there is any > difference... > > What compiler/platform are you using? The original post has been corrupted somewhat; this was an example of how C's syntax provides some dataflow hints to the compiler for optimization. Originally I said "A modern compiler will probably produce the same code", but that part got lost way up in the tree somewhere. -- Tim Behrendsen (tim@airshields.com)