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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32cfbb718858528b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-07 20:59:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3D018106.6080004@worldnet.att.net> From: Jim Rogers User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Commercial C To Ada 95 compiler References: <3D002D11.CC706952@adaworks.com> <4519e058.0206071148.9b87acf@posting.google.com> <3D0116F3.7254E263@despammed.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 08 Jun 2002 03:59:07 GMT NNTP-Posting-Host: 12.86.32.75 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1023508747 12.86.32.75 (Sat, 08 Jun 2002 03:59:07 GMT) NNTP-Posting-Date: Sat, 08 Jun 2002 03:59:07 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:25499 Date: 2002-06-08T03:59:07+00:00 List-Id: SteveD wrote: > "Wes Groleau" wrote in message > news:3D0116F3.7254E263@despammed.com... > > [snip] > >>A direct translation to Ada will reveal >>some bugs at compile time. And the developers >>are looking at a language they can read >>when they fix those bugs. >> > > I disagree. A direct translation to Ada should not reveal any bugs at > compile time. In fact it should replicate memory leaks and errant pointers. > If it doesn't do so, it is not a direct translation. You may be very wrong here. Ada compilers tend to identify many more errors at compile time than C compilers. This means that code which compiles without error on a C compiler, when directly translated to Ada, will may not compile. One simple example is indexing past the end of an array. C compilers simply will not catch this problem. Ada compilers will. On the whole, direct translation may not be possible. C uses implicit conversion between integer and floating point types. Ada provides no such implicit conversion. You will at least need to make all implicit C conversions explicit in Ada. Another incompatibility is trying to reference the control variable in a "for" loop outside the scope of the "for" loop. This is impossible in Ada and not uncommon in C. The C compiler will allow this. The Ada compiler will not. Your example of "direct" translation of a C for loop with a null body to an Ada while loop is a good approximation of the problem, but not, IMHO, a direct translation. A direct translation would have the C code also using a while loop. Ada for loops simply cannot demonstrate this error. Any attempt to do so will create a compiler error. Jim Rogers