comp.lang.ada
 help / color / mirror / Atom feed
* Re: C vs. Ada (was "C is better ...)
@ 1996-08-07  0:00 W. Wesley Groleau (Wes)
  1996-08-08  0:00 ` William Clodius
  0 siblings, 1 reply; 3+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-08-07  0:00 UTC (permalink / raw)



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."

1. C has strong typing?  The language where type conversions between
   float, integer, and boolean often occur without the programmer's
   knowledge?

2. If "optimizations are performed in the language-independent
   backend," how can strong typing, or any other feature of Ada
   make optimization easier?  Is the omitted word "most" the answer?

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-40)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C vs. Ada (was "C is better ...)
  1996-08-07  0:00 C vs. Ada (was "C is better ...) W. Wesley Groleau (Wes)
@ 1996-08-08  0:00 ` William Clodius
  1996-08-09  0:00   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: William Clodius @ 1996-08-08  0:00 UTC (permalink / raw)



In article <9608071745.AA09187@most> "W. Wesley Groleau (Wes)"
<wwgrol@PSESERV3.FW.HAC.COM> writes: 


   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."

   1. C has strong typing?  The language where type conversions between
      float, integer, and boolean often occur without the programmer's
      knowledge?

   2. If "optimizations are performed in the language-independent
      backend," how can strong typing, or any other feature of Ada
      make optimization easier?  Is the omitted word "most" the answer?

I made a mistake. I meant static typing not strong typing. Typing
largely determines the semantics of code, and the extent to which the
front end can define the static semantics of the code can influence
the back end's optimizations. The more semantic information the
backend has the easier it is to determine which code modifications do
not change the semantics.
-- 

William B. Clodius		Phone: (505)-665-9370
Los Alamos National Laboratory	Email: wclodius@lanl.gov
Los Alamos, NM 87545




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C vs. Ada (was "C is better ...)
  1996-08-08  0:00 ` William Clodius
@ 1996-08-09  0:00   ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1996-08-09  0:00 UTC (permalink / raw)



"   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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-08-09  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-07  0:00 C vs. Ada (was "C is better ...) W. Wesley Groleau (Wes)
1996-08-08  0:00 ` William Clodius
1996-08-09  0:00   ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox