comp.lang.ada
 help / color / mirror / Atom feed
From: dewarr@my-dejanews.com
Subject: Re: Ada --> C Translation, was: Win CE target
Date: 1998/09/30
Date: 1998-09-30T00:00:00+00:00	[thread overview]
Message-ID: <6us37l$rh0$1@nnrp1.dejanews.com> (raw)
In-Reply-To: F01sL5.5Ey.0.-s@inmet.camb.inmet.com

In article <F01sL5.5Ey.0.-s@inmet.camb.inmet.com>,
  stt@houdini.camb.inmet.com (Tucker Taft) wrote:
> As an example of reasonably readable C, I have appended a translation
> of a simple priority-heap package, where the automated translator did its
> best to preserve comments, Ada names, etc. in the generated C.  Note that
> constraint checks have been suppressed in this translation, to avoid
> offending the sensibilities of C programmers ;-).

It is not only the sensibilities of C programmers that would be offended
by putting in full constraint checking, but this would also impact the
readability considerably I suspect.

It is certainly the case that some subset of Ada can be represented as
readable C, especially if constraint checking is suppressed, my comments
were responding to the suggestion that the whole of Ada can be translated
to meet this criterion, and it is no suprise to me that Tuck agrees with
this assessment (all of Ada can be translated to C, but only a subset
will be readable). This is actually a well known result, at least two
previous commercial Ada compilers have operated by generating C, with
similar results.

By the way, efficiency and readability can definitely be at odds. From
experiments done in one case, it appears that the use of setjmp and
longjmp is generally less efficient than providing an extra parameter
on every call. This is most certainly true on the SPARC, where the
standard setjmp uses a kernel call -- this is by the way total incompetence,
there is no requirement for this approach, and if you are translating Ada
to GNU-C, you will find it far better to use the builtin setjmp and longjmp
functions of this compiler.

One place where the generated C will get very far from readable is packed
arrays. This important feature is completely missing from C. Perhaps you
can partly deal with it by macros, but only partly! Have a look at the
-gnatdg output from GNAT to get an idea of what has to be generated (this
is one thing that is currently handled by the front end of GNAT rather
than the backend).

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




  reply	other threads:[~1998-09-30  0:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-20  0:00 Win CE target William A Whitaker
1998-09-20  0:00 ` Tucker Taft
1998-09-21  0:00   ` dennison
1998-09-21  0:00     ` dewarr
1998-09-28  0:00       ` Ada --> C Translation, was: " Stefan Helfert
1998-09-29  0:00         ` Tucker Taft
1998-09-30  0:00           ` dewarr [this message]
1998-09-29  0:00         ` Robert A Duff
1998-10-10  0:00           ` Dr Amirez
1998-10-11  0:00             ` Dale Stanbrough
1998-10-10  0:00               ` Dr Amirez
1998-10-11  0:00                 ` Dale Stanbrough
1998-10-11  0:00                   ` Dr Amirez
1998-10-12  0:00                     ` Larry Kilgallen
1998-10-13  0:00                       ` dennison
1998-10-12  0:00                     ` Niklas Holsti
1998-10-12  0:00                 ` dennison
1998-10-12  0:00                   ` Larry Kilgallen
1998-10-14  0:00                   ` dewarr
1998-10-14  0:00                     ` Andi Kleen
1998-10-12  0:00                 ` PC
1998-10-12  0:00                   ` Operating System in Ada (was Ada --> C Translation) Larry Kilgallen
1998-10-12  0:00                     ` Tom Moran
1998-10-12  0:00                       ` Brian Rogoff
1998-10-13  0:00                         ` dennison
1998-10-13  0:00                           ` Brian Rogoff
1998-10-13  0:00                       ` Tucker Taft
1998-10-12  0:00                     ` Chris Morgan
1998-10-13  0:00                       ` Larry Kilgallen
1998-10-13  0:00                       ` Dale Stanbrough
1998-10-14  0:00                       ` dewarr
1998-10-12  0:00                     ` dennison
1998-10-21  0:00                     ` Van Snyder
1998-10-22  0:00                       ` Tom Moran
1998-10-13  0:00             ` Ada --> C Translation, was: Win CE target Robert I. Eachus
1998-10-14  0:00               ` Samuel Mize
1998-10-16  0:00                 ` Tasking/blocking system calls (was: Ada --> C Translation) Mats Weber
1998-09-20  0:00 ` Win CE target dewarr
1998-09-20  0:00 ` dewarr
1998-09-23  0:00 ` falis
replies disabled

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