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,76da32d8c4934801 X-Google-Attributes: gid103376,public From: dewarr@my-dejanews.com Subject: Re: Ada --> C Translation, was: Win CE target Date: 1998/09/30 Message-ID: <6us37l$rh0$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 396172141 References: <360FB3B0.5B0E218C@galileo.mpi-hd.mpg.de> X-Http-Proxy: 1.0 x5.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Sep 30 01:58:13 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-09-30T00:00:00+00:00 List-Id: In article , 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