comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: How do you bitwise operations in Ada '83 and '95
Date: Mon, 24 Jul 2006 07:08:23 +0100
Date: 2006-07-24T07:08:23+01:00	[thread overview]
Message-ID: <m2lkqjsffs.fsf@grendel.local> (raw)
In-Reply-To: uwta448i8.fsf@acm.org

Stephen Leake <stephen_leake@acm.org> writes:

> Simon Wright <simon@pushface.org> writes:
>
>> Stephen Leake <stephen_leake@acm.org> 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!



  reply	other threads:[~2006-07-24  6:08 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8B57A49E-38E9-44DC-9B4A-A3F69E058A97@amado-alves.info>
2006-07-20  9:39 ` Fwd: How do you bitwise operations in Ada '83 and '95 Marius Amado-Alves
2006-07-20 17:54   ` tmoran
2006-07-20 18:30     ` Marius Amado-Alves
2006-07-20 19:36       ` tmoran
2006-07-20 22:09         ` Simon Wright
2006-07-21 10:07           ` Stephen Leake
2006-07-21 19:09             ` Simon Wright
2006-07-21 19:45               ` tmoran
2006-07-23 15:59               ` Stephen Leake
2006-07-24  6:08                 ` Simon Wright [this message]
     [not found] <CD6E3BB8-52D2-4EED-A790-0184FE56A99A@amado-alves.info>
2006-07-20 20:41 ` Marius Amado-Alves
2006-07-20 23:13   ` Randy Brukardt
2006-07-21  5:38     ` Marius Amado-Alves
2006-07-21 22:09       ` Randy Brukardt
     [not found] <BFF12262-F906-4F9A-B867-D0373609F038@amado-alves.info>
2006-07-20 16:40 ` Marius Amado-Alves
     [not found] <9315684D-C216-4EDA-8852-0A6BD4C275B0@amado-alves.info>
2006-07-19 22:30 ` Marius Amado-Alves
2006-07-20  7:40   ` Georg Bauhaus
2006-07-20  9:29     ` Colin Paul Gloster
2006-07-20 12:31       ` Georg Bauhaus
2006-07-20 13:08         ` Colin Paul Gloster
2006-07-20 13:29           ` Marius Amado-Alves
2006-07-20 13:49           ` Georg Bauhaus
2006-07-21  5:23             ` Colin Paul Gloster
2006-07-21  8:00               ` Georg Bauhaus
2006-07-20  9:03   ` Stephen Leake
2006-07-20  9:38     ` Marius Amado-Alves
2006-07-21  9:53       ` Stephen Leake
2006-07-20 11:31     ` Dmitry A. Kazakov
2006-07-20 13:18       ` Marius Amado-Alves
2006-07-21  9:58       ` Stephen Leake
2006-07-21 12:09         ` Dmitry A. Kazakov
2006-07-21 19:03           ` Simon Wright
2006-07-22  8:32             ` Dmitry A. Kazakov
2006-07-22  8:57               ` Simon Wright
2006-07-22 10:52               ` Georg Bauhaus
2006-07-22 13:31                 ` Dmitry A. Kazakov
     [not found] <1153244316.853254.291560@m79g2000cwm.googlegroups.com>
2006-07-18 18:45 ` Robert A Duff
2006-07-18 18:53 ` jimmaureenrogers
2006-07-18 19:22   ` Jeffrey R. Carter
2006-07-18 21:32     ` jimmaureenrogers
2006-07-19  0:40       ` Jeffrey R. Carter
2006-07-19  3:55         ` jimmaureenrogers
2006-07-19  4:37           ` Jeffrey R. Carter
2006-07-19 13:05             ` jimmaureenrogers
2006-07-19 19:43               ` Jeffrey R. Carter
     [not found]             ` <1153313832.389434.144930@s13g2000cwa.googlegroups.com>
2006-07-19 13:55               ` Georg Bauhaus
2006-07-19 14:20               ` Robert A Duff
2006-07-19 19:30               ` Jeffrey R. Carter
2006-07-19 14:41             ` Robert A Duff
2006-07-18 19:21 ` Jeffrey R. Carter
2006-07-19  3:01 ` tmoran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox