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 21:14:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.socal.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3D0184BD.69723B2D@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en 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> <3D018106.6080004@worldnet.att.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 08 Jun 2002 04:14:29 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1023509669 66.75.151.160 (Fri, 07 Jun 2002 21:14:29 PDT) NNTP-Posting-Date: Fri, 07 Jun 2002 21:14:29 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:25501 Date: 2002-06-08T04:14:29+00:00 List-Id: Jim Rogers wrote: > One simple example is indexing past the end of an array. > C compilers simply will not catch this problem. Ada compilers will. True, assuming it's sufficiently obvious. I would think there might be a lot of weird C-ish stuff that Ada would have trouble doing, like malloc'ing an array of floats and then casting it to a (char *) and filling it in with some pattern. > 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. Well, I would imagine that the translator could do this, yes? C: f = i; Ada f := Float (i); > 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. Well, if your translator translates C for loops that have references to the index variable outside the for loop into Ada for loops, it'll be a problem. They'd have to translate it to the corresponding while loop. I guess if you're going to be strict enough about the word "direct translation" to mean that a C for loop can't translate to an Ada while loop, what you say would be true. I don't think that's what's generally meant by "direct translation". I think there would be more problematic constructs, tho, like static variables (inside and/or outside of functions), pointers cast to different types, and so on. -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. ** http://home.san.rr.com/dnew/DNResume.html ** ** http://images.fbrtech.com/dnew/ ** My brain needs a "back" button so I can remember where I left my coffee mug.