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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e3feb606f668a7c1 X-Google-Attributes: gid103376,public From: Gary Scott Subject: Re: Why should hackers love Ada. (Re: Ada 95 based RTOS) Date: 2000/02/25 Message-ID: <38B5C9E6.143A32D6@flash.net>#1/1 X-Deja-AN: 589546416 Content-Transfer-Encoding: 7bit References: <88ilp7$bcm$1@nnrp1.deja.com> <38ADCA44.3B91BF6F@averstar.com> <88qli0$gvr$1@nnrp1.deja.com> <38B2A2A1.FDCDDFE7@honeywell.com> <88ugrd$7j7$1@nnrp1.deja.com> <890ght$bih1@ftp.kvaerner.com> <38B3EA94.E3AB4929@maths.unine.ch> <38B41432.88D7389F@quadruscorp.com> <38B47521.1A80B6A1@lmtas.lmco.com> <38B55928.8A0EAB06@quadruscorp.com> <2000Feb24.122253.1@eisner> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flash.net X-Trace: news.flash.net 951437753 216.215.84.76 (Thu, 24 Feb 2000 18:15:53 CST) Organization: Home MIME-Version: 1.0 Reply-To: scottg@flash.net NNTP-Posting-Date: Thu, 24 Feb 2000 18:15:53 CST Newsgroups: comp.lang.ada Date: 2000-02-25T00:00:00+00:00 List-Id: Larry Kilgallen wrote: > In article <38B55928.8A0EAB06@quadruscorp.com>, "Marin D. Condic" writes: > > Gary wrote: > >> I see this reference to ADA being good at bit twiddling, periodically. > >> Virtually all high-level languages provide facilities for bit twiddling. Is > >> there something unique about ADA (I'm a non-ADA programmers, sorry). Is this > >> a reference to a transfer function (other languages have this) or memory > >> aliasing tricks? > > > > Well, I don't know what the rest of the world means by "bit twiddling" > > but I know what *I* mean when I say that. ;-) > > > > You have all the facilities you need in Ada (Ada95 - Ada83 didn't do > > this well) to do shifting, masking & other manipulations of individual > > bits within words. If you've ever had to do interfacing to low level > > devices, hardware registers, I/O ports, etc., then you know that you > > can't always deal with data as an "abstraction" where you can allow the > > compiler to pick whatever representations it wants and manipulate things > > any way it likes. Often I have been up against time constraints where > > even if a high level method of solving the problem may work fine, we > > dipped into bit masks and logical operators because they degenerated to > > much more efficient code. > > > > Ada95 lets you get at things like this when you need to. The difference > > between Ada and C on this issue is that with Ada it is a "last resort" > > whereas with C it is a "way of life". (Look at how lots of bindings to C > > stuff includes numeric constants for specifying options by or'ing > > together the constants. While Ada can do that, it isn't the usual > > idiom.) > > I think a major advantage of Ada is that it lets the programmer deal > at a higher level for the main body of the program, while only the > interface description contains the specification that bits 2-4 are > treated as a numeric field for the unit number. The compiler aids > and enforces adherence to that specification without requiring the > programmer to be constantly thinking about it and getting it right. This is a good feature, but many other languages have similar features (some very old like Jovial and PL/1). In other languages, my experience is that you simply define pack/unpack/scale routines and write the main executive and high-level functionality in a high-level fashion (possibly OO) and simply invoke these low-level "reformat" routines at the top and bottom of the frame (or as-required). Then again, I'm also used to being able to embed assembly to gain access to an interval timer or generate an interrupt right into the high-level language code. -- Gary Scott mailto:scottg@flash.net mailto:webmaster@fortranlib.com http://www.fortranlib.com