comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Representation clauses for base-64 encoding
Date: Mon, 26 Dec 2011 10:33:08 +0200
Date: 2011-12-26T10:33:08+02:00	[thread overview]
Message-ID: <9lqpq5Ft05U1@mid.individual.net> (raw)
In-Reply-To: <jd0lje$3gv$1@munin.nbi.dk>

On 11-12-23 03:30 , Randy Brukardt wrote:
> "Niklas Holsti"<niklas.holsti@tidorum.invalid>  wrote in message
> news:9lgi3jFhaU1@mid.individual.net...
>> On 11-12-22 11:41 , Natasha Kerensikova wrote:
> ...
>>>      type Octet_Block is array (1 .. 3) of Octet;
>>>      pragma Pack (Octet_Block);
>>
>> I would add the following, to check that packing is effective:
>>
>>        for Octet_Block'Size use 24;
>
> I think it would probably be better to forget Pack and actually say what you
> mean here:
>
>      type Octet_Block is array (1 .. 3) of Octet;
>      for Octet_Block'Component_Size use 8;
>
> "Pack" should be reserved for cases where you don't care about the exact
> layout, you just want to save space. Here you do care about the exact
> layout, so use a Component_Size.

Fine adjustment: when Component_Size is not a factor or multiple of the 
word size, RM 13.3(73) says that the array may also have to be packed in 
order to eliminate gaps between components.

Of course, a Component_Size of 8 bits is usually a factor of the word 
size. But perhaps not always.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2011-12-26  8:33 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 [this message]
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
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