comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Representation clauses for base-64 encoding
Date: Thu, 22 Dec 2011 19:42:50 -0600
Date: 2011-12-22T19:42:50-06:00	[thread overview]
Message-ID: <jd0mas$5ok$1@munin.nbi.dk> (raw)
In-Reply-To: 9lgls6FticU1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:9lgls6FticU1@mid.individual.net...
...
>> http://www.adacore.com/2008/03/03/gem-27/
>
> I am surprised and disappointed that there is *no* mention of portability 
> problems in that "gem". This is marketing hype for GNAT, not sound 
> programming advice.

There is no portability problem in common use. For instance, Natasha's code 
(once the rep. clauses are right) will work on both a big-endian and 
little-endian machine without change. (And yes, I'd use the record rep. 
clauses to do this conversion; I think I have some code that looks very much 
like his sample.)

The problem occurs when you need to process big-endian data on a 
little-endian machine (or vice versa). That is not that common of a need --  
it surely happens (as in your application), but you are overstating it if 
you think most programs would run into it.

Most code does not care which bits are which bits in the word -- like this 
encoding code -- they just need a consistent representation. That is, it 
doesn't matter where bit 0 is, so long as it is the same in every item that 
is processed.

                                       Randy.






  parent reply	other threads:[~2011-12-23  1:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22  9:41 Representation clauses for base-64 encoding Natasha Kerensikova
2011-12-22 11:20 ` Niklas Holsti
2011-12-23  1:30   ` Randy Brukardt
2011-12-26  8:33     ` Niklas Holsti
2011-12-28  0:09       ` Randy Brukardt
2011-12-22 11:37 ` Georg Bauhaus
2011-12-22 12:24   ` Niklas Holsti
2011-12-22 15:09     ` Georg Bauhaus
2011-12-22 16:00       ` Natasha Kerensikova
2011-12-22 22:18         ` Georg Bauhaus
2011-12-25 10:17           ` Niklas Holsti
2011-12-27 11:23             ` Georg Bauhaus
2011-12-27 19:37               ` Niklas Holsti
2011-12-27 20:49                 ` Robert A Duff
2011-12-27 23:47                   ` Niklas Holsti
2011-12-29  0:50                     ` Robert A Duff
2011-12-30 20:54                       ` anon
2011-12-30 20:56                       ` Niklas Holsti
2011-12-23  1:42     ` Randy Brukardt [this message]
2011-12-28  8:59       ` Niklas Holsti
2011-12-29  5:41         ` Randy Brukardt
2011-12-29 10:10           ` Dmitry A. Kazakov
2011-12-23  1:33 ` Randy Brukardt
replies disabled

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