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,a298d80682a92f11 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: C vs. Ada (was "C is better ...) Date: 1996/08/09 Message-ID: #1/1 X-Deja-AN: 173318182 references: <9608071745.AA09187@most> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-09T00:00:00+00:00 List-Id: " William Clodius points out: "...most optimizations are performed in the language-independent backends. ... Strong typing in any language helps with optimization, and both C and Ada ... have strong typing."" It is true that most optimizations are performed in LI backends (well let's say that this is the case with some technologies, not all, certainly, for example, many Ada 83 code generators were Ada specific backends). It is also true that strong typing helps, but C definitely lacks the helpful strong typing. in Ada if we see X.all := 3; and X is of type access my_integer, where my_integer is derived from integer, then we now that a variable of type integer cannot be disturbed by this assignment. The equivalent in C *x = 3; can destroy any int variable. In general the amount of aliasing and typing information sent to the backend, even an LI backend, is very much language dependent, and clearly Ada is in a position to send much more aliasing and typing information along. That does not mean the backend necessarily takes advantage of this possibility, but at an abstract language level, there really IS a difference between C and Ada from an optimization point of view, and potentially this means that a perfectly optimizing Ada compiler can typically do better than a perfectly optimizing C compiler, where perfectly optimizating means generating optimal code using all the conceptually available information from the front end. Note that real compilers are only (quite imperfect) approximations to "perfectly optimizing" compilers, so whether this effect is actually visible in practice is hard to say.