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: "Byron B. Kauffman" Subject: Re: C is 'better' than Ada because... Date: 1996/08/01 Message-ID: <3200A849.372A@lmtas.lmco.com>#1/1 X-Deja-AN: 171401848 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> <4tkeuk$cu2@goanna.cs.rmit.edu.au> <01bb7e2f$aeef4660$87ee6fce@timpent.airshields.com> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Tactical Aircraft Systems mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.c x-mailer: Mozilla 2.01 (X11; I; SunOS 5.4 sun4m) Date: 1996-08-01T00:00:00+00:00 List-Id: Tim Behrendsen wrote: > snip... > > You are probably right, if you let the optimizer handle everything. > But C also gives the capability to do things such as ... > > 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) > Tim, I'm 180 degrees out of phase from you, experience-wise. I've professionally done around 10klocs of Ada, and about 24 or so lines of C, although I sucked it up and took C++ from a local junior college last fall just so I can say that I did. With all that in mind, I'm going to ask (in reference to the code samples above), which is easier to read and/or maintain? The answer, from my C-ignorant perspective, is the non-C example, but a C compiler obviously wouldn't have a problem with it. Unfortunately, though, the compiler is not the one that maintains or ports the code to another platform. IMHO, this is where Ada has the edge over C - it was designed primarily with the -ilities in mind. I don't know if it is the industry norm, but my primary job description for years was 80% code maintenance and rehosting, 20% new code. It is my perception that that is what was eating DoD's lunch and why they commissioned Ada. Why isn't it used more? If you ask two people to write a program without specifying the language (one knows Ada better than C, the other knows C better than Ada), their first choice will be their favorite language. Why? Because that's what they are most comfortable with. A friend of mine (a C guy) was trashing Ada (too slow, etc.) and I managed to turn it around on him. He admitted, that, well, he just didn't know that much about Ada, so it would take him longer to do something in Ada than in C. If my professional experience track was "assembler - FORTRAN - C" instead of "assembler - FORTRAN - Ada - C", I might feel differently.