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-Thread: 103376,f822ae7b0f7433c1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news.germany.com!aioe.org!not-for-mail From: Cesar Rabak Newsgroups: comp.lang.ada Subject: Re: Translating an embedded C algorithm Date: Tue, 16 Jan 2007 23:02:15 -0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: zEJK12x7djBBvRARhduGQA.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org In-Reply-To: User-Agent: Thunderbird 1.5.0.8 (X11/20061109) Xref: g2news2.google.com comp.lang.ada:8211 Date: 2007-01-16T23:02:15-02:00 List-Id: Simon Wright escreveu: > "Alexander E. Kopilovich" writes: > >> Ada has many features, which are directly related to real-time >> embedded programming, and which have no counterparts in C (tasking, >> timing, and fixed-point types built in). >> >> Therefore there is little chance for translation of a program of >> that kind from C to Ada without essential redesign of that program >> (for making proper use of available Ada features). >> >> But if the program will be redesigned for Ada then there will be >> little sense in placing those C and Ada implemetation side-by-side >> for comparison. >> >> So, within this kind of software, probably C and Ada may be sensibly >> put side-by-side not for pieces of code or relatively small >> algorithms, but only for whole projects (applications or even >> systems). > > But the OP's example isn't in any way specifically embedded or RT, and > in a one-page example one wouldn't expect more. I think an implementation in a microcontroller can count easily as 'embedded', and at least if the OP doesn't elaborate, I agree it can be non RT at all. > There are some > externally-defined macros which might be 'embedded', and which could > be interesting to us but perhaps don't address the point to be made. I don't think the macros are any difference in this context. > > If what is wanted is an example of what code looks like then I see no > reason not to provide an Ada translation. If possible, it should be in > real Ada and not a transliteration of the C. > This is the thing I second in full. However, the OP still did not answer my private e-mail where I asked some questions in order to ascertain how much of effert he would need. For example to make a ADC package (I already played a little bit with it ) creating a Adc_Int type. From the PDF example one could, conceivable, subtype even further to the range from the Table 1 of his article, etc.