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-Thread: 103376,36b302576d78847a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!azure.qinip.net!xara.net!gxn.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How do you bitwise operations in Ada '83 and '95 Date: Mon, 24 Jul 2006 07:08:23 +0100 Organization: Pushface Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1153721304 4664 62.49.19.209 (24 Jul 2006 06:08:24 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 24 Jul 2006 06:08:24 +0000 (UTC) Cancel-Lock: sha1:8uwY+me7VzijT3fYAMqRo7bFQlQ= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news2.google.com comp.lang.ada:5891 Date: 2006-07-24T07:08:23+01:00 List-Id: Stephen Leake writes: > Simon Wright writes: > >> Stephen Leake writes, responding to me: >> >>>> I have a feeling that shift&mask ends up more understandable >>> >>> Never. >>> >>>> and reviewable. >>> >>> In Ada 95, maybe. In Ada 2005, not. >> >> Really, understandable and reviewable are very similar, so I don't >> see how something could be (possibly) more reviewable while never >> more understandable. > > Hmm. To me, "understandable" means "expressed in terms I am familiar > with, using idioms I am familiar with, and unambiguous". Or > something like that. > > While "reviewable" means "traceable to source documentation". > > So if I am familiar with the Ada 95 idiom for endianness-independent > rep clauses, they are "understandable". But because they are > complex, they may be less reviewable. I've never done a _formal_ > review (trace to source docs) of any software, so I'm on shaky > ground here. To me, code review is a process exceuted by people whose intention is to ensure that the code does the right thing. Part of that is to check that it's meeting its requirements, some of the requirements are customer-imposed functional ones. So the people have to be able to understand the code, and it helps if it's obviously doing the right thing. There are ways of writing Ada 95 rep clauses that were endian-indepednent, I found them very clever but perhaps too clever. >> Seriously, the C >> >> field = (longword >> 15) & 0x3f; >> >> is pretty clear. > > At the bit level, yes. But if the 7 bits are supposed to represent > some object, actual names would be far preferable. I hope no one thought I was proposing that this bit twiddling (C or Ada) should get out of package bodies!