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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8623fab5750cd6aa X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 13 Jun 2004 18:15:29 -0500 Date: Sun, 13 Jun 2004 19:15:28 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada BIND was: Improving Ada's image - Was: 7E7 Flight Controls Electronics References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <1086715817.122983@master.nyc.kbcfp.com> <1086733411.736049@master.nyc.kbcfp.com> <3Auxc.11998$XY6.1296622@read2.cgocable.net> <40C85035.4020706@noplace.com> <40CA0032.3010103@noplace.com> <40CAF0E1.4000904@noplace.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-k1OK4skj3mIcGeJlgwCWMcMsCRm3VvuteHnqJGXkfvsJILdhwxV/MOPd6dLzDVJhglybthwkwsQK/LW!t4TYdCD4BPYFfwfGYrLc0oNPUMttVZHgU6O2Pc9gCXOyebktIQE7x3xzCnad4g== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1454 Date: 2004-06-13T19:15:28-04:00 List-Id: Russ wrote: > You seem to assume that the "recoding in Ada" is a labor-intensive > manual process. But what if it could be automated? I'm an aerospace > engineer, and I don't know much about automated C-to-Ada conversion, > but I think its at least worth consdering. Certainly the resulting Ada > code would have *some* of the benefits of Ada. > > I understand that a crappy design will still be a crappy design even > in Ada, but if the original C application works reasonably well, > perhaps the automated Ada conversion could be manually tweaked to > improve security, reliability, or some other aspect. That certainly > seems like a more attractive option than manually rewriting the whole > thing. > > Speaking of crappy designs, I sense some disdain for Linux here > because it is written it C. I suggest you all get over that and fast, > or you will just make fools of yourselves. I suggested a long time ago > here that C is to Ada as a motorcycle is to a car. It's not nearly as > safe, but experts can use it effectively. Needless to say, Linux was > written by top exerts. That's not to say that it couldn't be done > better in Ada, but you can't simply assume that. > > I think the first step is to try an automated conversion of Linux to > Ada, then go from there. I would try it myself, but I wouldn't know > how to compile a kernel if it was staring me in the face. As I said, > I'm an aerospace engineer. Actually, the problems occur mostly in places where C just has serious problems doing sanity checks right. They can be done but it is a pain: Check the length of the string to be read, then read either that number of characters or the maximum buffer size. Of course, this means in many cases you have to read the string twice while Ada allows you to read it once. (Ask for N characters and get a count of how many you get.) As for rewriting a C program in Ada, what I have done is use the old Intermetrics tool to create package specs from .h files, then create bodies that use pragma Interface(C, ...) or now pragma Import. Then start with the main program and rewrite things--that need to be rewritten--one function at a time. That converts a huge task into a lot of smaller, and much more likely to succeed without error, tasks. If the reason you are doing this is, as implied above, to replace some of the interfaces with better ones. (Which is the only reason I have ever done this.) You get up and running with the main program in Ada, then get a "thick" binding to compile as a package that calls the thin binding you created, change the main program to use the new interface, then rewrite the body of the thick binding in Ada. The last step is not necessary, but... One time when I did exactly this, rewritting the body of the interface packages in Ada was actually simpler than binding to the existing C. This won't always be the case, but when it is the reason for the rewrite in the first place you will be amazed. (Or to state it differently, in a way everyone here should understand, often in Ada 90% of the work goes into designing the package specifications. If they are done well, writing the bodies is easy.) -- Robert I. Eachus The ideology he opposed throughout his political life insisted that history was moved by impersonal tides and unalterable fates. Ronald Reagan believed instead in the courage and triumph of free men and we believe it all the more because we saw that courage in him. -- George W. Bush June 11, 2004