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,dab7d920e4340f12 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public From: Antoine Leca Subject: Re: is Ada 'better' than C? (Was: Re: C is 'better' than Ada because...) Date: 1996/08/06 Message-ID: <320708C9.6239@Renault.Fr>#1/1 X-Deja-AN: 172439698 references: <31e02c32.342948604@netline-fddi.jpl.nasa.gov> <4rr961$hdk@btmpjg.god.bel.alcatel.be> <31e180c5.430136383@netline-fddi.jpl.nasa.gov> <4s4adc$l4a@ecuador.it.earthlink.net> <31EA0B65.3EF8@wgs.estec.esa.nl> <31EF7E48.5ABE@lmtas.lmco.com> <01bb7bfc$3c5ca460$96ee6fcf@timhome2> <01bb7ea7$b971c5e0$96ee6fcf@timhome2> <9608020139.AA29105@pulsar.telesoft> <32066ba3.274229471@netline-fddi.jpl.nasa.gov> content-type: text/plain; charset=us-ascii organization: RENAULT mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.c x-mailer: Mozilla 2.02 (Win95; I) Date: 1996-08-06T00:00:00+00:00 List-Id: Kevin D. Quitt wrote: > > I think that anybody who depends on optimization to make their code work It seems clear that a code which work with optimisations on and don't work when they're off is brocken, isn't it? > or to make it efficient is barking up the wrong tree. Ah ah. This's not the same. For me, an optimizer is clearly the tool you need when you're seeking efficiency. (Really, it is "one of the tools". Knuth's over algorithmics is another, more important :-) > Except for unusual > circumstances (e.g., embedded code), one should write straightforward, easily > debugged/tested/modified code. Full OK with you here. You could add "maintainable" if it sounded English. > Once the code works, *then* you turn on the optimizers (and test again). OK again. For much code, I don't think this step is necessary. > If the code isn't fast enough, first look for a better algorithm. Oh yes ! > Barring that, look at the code produced and see what the > compiler's problem is, and what alternate/equivalent code can be used to help > the compiler. This latter is rarely necessary, and usually under exotic > circumstances. Very rarely, IMHO. For doing that, you need a good knowledge of the arcanes of the machine (this is not given to everyone, nor it seems necessary to me). And to be of useful help you must understand why the compiler has produced the actual output, i.e. to understand the internal mechanisms of the compiler. Moreover, to actually help the compiler, you'd to be even more "clever" by knowing what each differences will make to the output, thus knowing how the compiler reacts to each source layout. (Kevin, "you" above doesn't mean yourself, of course) To me, this is not the right way for programming efficiency _as a whole_. Your scheme drives to a world where _all_ programmers must be experts in compiler theory (admittedly, all programmers involved with efficiency). I don't feel like it: for me, it is much better to have compilers writters that do a better job while writting "cleverer" optimizers, perhaps at the cost of compile time, than to teach every programmers how to hardcode an over-optimisation of the output code. What I don't clearly see is whether C or Ada (or whatever else) is better or worse in the process of writing optimizers and improving them. Advantages of C are the small size of the language (not the same with C++ :) and its broad audience, which drives biggers teams of compilers writters to the point. Advantages of Ada are the fewest number of side effects or branches, which help to compute execution paths. The demonstration is difficult, because it can't be made on code provided by gurus (we all know that one can provide an algorithm biased toward one or other language) but instead on actual "production" code... Open question. Antoine Leca