comp.lang.ada
 help / color / mirror / Atom feed
From: gdemont@my-deja.com
Subject: Re: Bit manipulation
Date: 2000/11/08
Date: 2000-11-08T00:00:00+00:00	[thread overview]
Message-ID: <8ubhlh$ejv$1@nnrp1.deja.com> (raw)
In-Reply-To: 8ubeq8$cgm$1@nnrp1.deja.com


> Of course we could give a simple answer involving the
> obvious solution of converting Character'Pos values to
> a modular type and then doing shifts and masks in the
> normal manner, but that would be a disservice.
>
> I see a *lot* of code that is clearly written by C programmers
> and greatly overuses low level bit twiddling techniques that
> are appropriate to C but not to Ada.
>
> If someone simply wants to get a job done in the dirtiest
> possible fashion, and wants someone else to do the work,
> CLA is not the place to expect free help :-)

I'm not sure that Mr Binetti intends to do dirty things.

After all, the conversions like Character'Pos <-> modular
or signed <-> modular precisely draw the attention about
when you enter the realm of bit twiddling on a certain number
of bits, and when some bit and bit length have a special
meaning. They are verbose enough to be re-found after a while,
and to discourage using them when a "* (2**7)" or a "mod 32" suffices.
The dirty thing would be e.g. to allow bit twiddling on a signed
integer, and this is the cause of fast-rotting code in C or some
Pascals; fortunately Ada95 doesn't allow it and has an elegant and
efficient solution for that issue.

I'm sure the users are adult enough to find the most appropriate
formulations for _their_ problems after some weeks of Ada
programming; therefore hiding the availability of modular types
_is_ a disservice. If one tells them that the only solution to mask
bits is to write 20 lines of records definitions with representation
clauses, they won't use Ada at all, simply!

Gautier


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~2000-11-08  0:00 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-07  0:00 Bit manipulation Sandro Binetti
2000-11-07  0:00 ` Larry Kilgallen
2000-11-07  0:00   ` John English
2000-11-08  0:00   ` gdemont
2000-11-08  0:00     ` Robert Dewar
2000-11-08  0:00       ` Sandro Binetti
2000-11-08  0:00         ` gdemont
2000-11-09  4:00           ` Ken Garlington
2000-11-09  0:00             ` Larry Kilgallen
2000-11-09  0:00               ` Ken Garlington
2000-11-08  0:00         ` Nicolas Brunot
2000-11-08  0:00         ` Dale Stanbrough
2000-11-09  0:00           ` Sandro Binetti
2000-11-09  0:00             ` Ken Garlington
2000-11-09  0:00             ` gdemont
2000-11-10  0:00             ` Scott Ingram
2000-11-09  3:59         ` Ken Garlington
2000-11-09  4:52         ` Robert Dewar
2000-11-08  0:00       ` gdemont [this message]
2000-11-08  0:00         ` Larry Kilgallen
2000-11-09  4:50           ` Robert Dewar
2000-11-10  0:00             ` Lao Xiao Hai
2000-11-09  4:47         ` Robert Dewar
2000-11-09  0:00           ` gdemont
2000-11-11  0:00       ` Redryder
2000-11-11  0:00         ` Jeff Carter
2000-11-11  0:00           ` Redryder
2000-11-12  2:07             ` Ken Garlington
2000-11-12  5:56             ` Jeff Carter
2000-11-12  0:00               ` Robert Dewar
2000-11-12  0:00                 ` tmoran
2000-11-13  0:00                   ` Robert Dewar
2000-11-14  0:00                     ` Marc A. Criley
2000-11-13  0:54                   ` Ken Garlington
2000-11-12  6:40               ` tmoran
2000-11-13  0:00         ` Lutz Donnerhacke
2000-11-13  0:00           ` Robert Dewar
2000-11-13  0:00             ` Lutz Donnerhacke
2000-11-13  0:00               ` Robert Dewar
2000-11-13  0:00                 ` Lutz Donnerhacke
2000-11-13  0:00                   ` Pat Rogers
2000-11-13  0:00                     ` Brian Rogoff
2000-11-13  0:00                       ` F. Britt Snodgrass
2000-11-15  0:00                         ` Lutz Donnerhacke
2000-11-13  0:00                       ` Pat Rogers
2000-11-14  0:00                       ` Georg Bauhaus
2000-11-15  0:00                         ` Lutz Donnerhacke
2000-11-14  0:00                   ` Martin Dowie
2000-11-15  0:00                     ` Lutz Donnerhacke
2000-11-20  0:00                 ` Randy Brukardt
2000-11-21  0:00                   ` Lutz Donnerhacke
2000-11-21  0:00                     ` Stephen Leake
2000-11-22  0:00                       ` Lutz Donnerhacke
2000-11-13  0:00           ` Robert Dewar
2000-11-13  0:00             ` Lutz Donnerhacke
2000-11-13  0:00               ` Robert Dewar
2000-11-13  0:00                 ` Lutz Donnerhacke
2000-11-08  7:18   ` Sandro Binetti
2000-11-07  0:00 ` gdemont
2000-11-08  7:22   ` Sandro Binetti
2000-11-10  7:24 ` Thank you all for your contribution ! Sandro Binetti
  -- strict thread matches above, loose matches on Subject: below --
2005-02-07 12:37 Bit manipulation Maurizio
2005-02-07 13:20 ` Martin Krischik
2005-02-07 15:32 ` Martin Dowie
2005-02-07 18:04   ` Martin Krischik
2005-02-08  0:32 ` Randy Brukardt
2005-02-08  3:11 ` Steve
2005-02-08 18:51   ` tmoran
1999-04-04  0:00 bit manipulation Jack Chow
1999-04-04  0:00 ` Matthew Heaney
1999-04-05  0:00 ` dennison
replies disabled

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