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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0123581076a0cf3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-08 19:13:55 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!blanket.mitre.org!linus.mitre.org!linus!mbunix!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: Ada ad in Embedded Systems Programming stinks Date: 8 Sep 94 17:28:20 Organization: The Mitre Corp., Bedford, MA. Message-ID: References: <34ecqc$b5q@source.asset.com> <34g5v3INN6q2@phage.cshl.org> NNTP-Posting-Host: spectre.mitre.org In-reply-to: dag@control.lth.se's message of 08 Sep 1994 17:12:57 GMT Date: 1994-09-08T17:28:20+00:00 List-Id: In article dag@control.lth.se (Dag Bruck) writes: > What areas, he asked curiously... I would be greatly interested in a > discussion of things that C does better than Ada, in particular from > someone whose understanding of Ada is beyond doubt. The canonical example is device drivers. But any code where the bit representation is more important than the data's value or where you spend a lot of time "punning" between two different views of the same data fall in the same category. For example, a compression algorithm that uses variable length representations of repeated strings. You can write these in Ada--with liberal use of Unchecked_Conversion--but it is more readable if you use bit operations on integers, or union types, etc. Another (ancient) case was where I needed to find the first bit set in a large Boolean array. The trick was to convince the compiler to use the special string processing operations, then do a conversion from the first non-null character found to a bit offset. (Anyone else remember translate and test instructions? In any case, the array was very sparse, and this way the only use of memory bandwidth was to fetch data.) Could have written it in assembler, but this code was portable. It just wouldn't run anywhere near as fast on a different hardware architecture. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...