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: 109fba,f2cac7a61edd058a,start X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: z007400b@bcfreenet.seflin.lib.fl.us (Ralph Silverman) Subject: Re: C is 'better' than Ada because... Date: 1996/07/31 Message-ID: <4tocnn$fta@nntp.seflin.lib.fl.us> X-Deja-AN: 171269255 references: <31e02c32.342948604@netline-fddi.jpl.nasa.gov> organization: SEFLIN Free-Net - Broward newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-07-31T00:00:00+00:00 List-Id: William Clodius (clodius@hotspec.lanl.gov) wrote: : In article <01bb7bfc$3c5ca460$96ee6fcf@timhome2> "Tim Behrendsen" : writes: : Ken Garlington wrote in article : <31EF7E48.5ABE@lmtas.lmco.com>... : > Sandy McPherson wrote: : > > and produce efficient machine code. : > : > Why is this an advantage of C over Ada? Ada certainly produces efficient : > machine code, given a good compiler. In fact, there are examples of Ada : > outperforming C with regard to efficiency. : The one big advantage C has traditionally had over other : languages is efficient compilation. The reason is that 'C' is one : of the few languages that provides concepts such as register : variables to give hints to the compiler. : This ignores Garlington's reply. If this was important, why do : languages such as Ada, Fortran, Sisal, etc., often generate more : efficient code than C athough they lack that hint? On heavily : pipelined processors, register scheduling is such a complex task that : the human analysis is rarely useful and that hint is almost uniformly : ignored. As to compiler speed, while C's coding brevity helps some : aspects of compilation, its typical reliance on macros and the details : of its declaration syntax result in a language that is harder to : compile than some other languages such as Oberon. : Yes, you can wave your hand and say, "well, the compiler : should take care of that". But then, reality rears its head, and : we realize that there are *no* compilers that are that smart. : Here's an old saying that I just made up ... : Behrendsen's Law: "All optimizers are crap." : We will never have an optimizer that can do as good a job : as human optimization until we get "strong AI", but that would : take an actual science of AI to exist (let's not get started on : *that*!). C is one of few languages that recognizes this. : While on modern processors a human can still compete with a compiler : on small pieces of code, provided he works directly in assembler, : doing that on every portion of a significant code is too exhausting : for humans. C is no substitute for assembler in such cases. The : aspects of C that are thought of as resembling assembler, either loose : semantic information usefull for global analysis, e.g., the : distinction between pointers and arrays, or are shorthands for : constructs, e.g., i=i+1, that are easily recognized by any compiler. : Since C is such a small language, this also makes it : easier for the compiler/optimizer to a (relatively) good job. : Most compilers nowadays use backends that are common among several : languages, and most optimizations are performed in the language : independent backends. The size of the language has relatively little : effect on optimization compared to the detailed semantics of the : language. Strong typing in any language helps with optimization, and : both C and Ada (indeed many other languages) have strong : typing. Unfortunately, while C is a small language, its reliance on : pointers and side effects introduces optimization problems not present : in many other languages, e.g, Ada, Fortran, Sisal, etc. : -- : William B. Clodius Phone: (505)-665-9370 : Los Alamos National Laboratory Email: wclodius@lanl.gov : Los Alamos, NM 87545 -- **************begin r.s. response*************** 1) re. optimizers... this is puzzling... certainly these work quite well generally... and, generally, are far better than nothing!!! (by the way ((ms pc dr)dos) 'c' language development system, (SHAREWARE) hi-tech pacific ppd (v7.50) includes a remarkable optimizer.) 2) certainly, increasingly, computer programming is automated, and the old hand-crafted cool stunts become increasingly redundant, as, generally, in work increasingly automated... the advantages cited re. the 'c' programming language relate largely to the origins of this in 'the old days'. the reaction... retro programming ^^^^^^^^^^^^^^^^^ as with 'wooden ships and iron men' , is coming... or, perhaps, already here... like tall ships to train elite cadets... and/or surviving as a folk craft... **************end r.s. response***************** Ralph Silverman z007400b@bcfreenet.seflin.lib.fl.us