From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Ada array contiguity.
Date: Mon, 20 Feb 2023 08:12:41 +0100 [thread overview]
Message-ID: <tsv6h4$mi2b$1@dont-email.me> (raw)
In-Reply-To: <k5f625F5lhmU3@mid.individual.net>
Le 19/02/2023 à 18:54, Niklas Holsti a écrit :
> On 2023-02-19 19:10, J-P. Rosen wrote:
>> Le 19/02/2023 à 15:59, Niklas Holsti a écrit :
>>> Indeed. But it seems to me that Arr'Size = Arr'Length * Comp'Size is
>>> the meaning usually intended for programming purposes.
>>
>> Certainly not if Comp'Size is not an integer number of bytes.
>
> I'm not so certain. By choosing various roundings-up of the component
> size, you can choose between "bit-contiguous", "byte-contiguous", etc.
>
> For example, bit-contiguous with 2-bit components:
>
> type Comp is (A, B, C, D) with Size => 2;
>
> type Arr is array (1 .. 10) of Comp
> with Pack, Size => 10 * Comp'Size;
>
> Nybble-contiguous with Comp'Size => 4, byte- (octet-) contiguous with
> Comp'Size => 8, etc.
>
Of course, if you add representation clauses, the compiler will obey
them. But the OP's question was whether it was /guaranteed/ to have
contiguous representation, and the answer is no - for good reasons.
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
https://www.adalog.fr https://www.adacontrol.fr
next prev parent reply other threads:[~2023-02-20 7:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-19 13:34 Ada array contiguity Rod Kay
2023-02-19 14:28 ` J-P. Rosen
2023-02-19 14:59 ` Niklas Holsti
2023-02-19 15:08 ` Dmitry A. Kazakov
2023-02-19 17:10 ` J-P. Rosen
2023-02-19 17:54 ` Niklas Holsti
2023-02-19 19:05 ` Dmitry A. Kazakov
2023-02-20 7:12 ` J-P. Rosen [this message]
2023-02-19 22:02 ` Jeffrey R.Carter
2023-03-01 13:22 ` Rod Kay
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox