comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problem with Position of the enumeration Type
Date: Thu, 24 Jan 2019 15:43:53 -0600
Date: 2019-01-24T15:43:53-06:00	[thread overview]
Message-ID: <q2dbiq$7lt$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: gauihgF9eu2U1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:gauihgF9eu2U1@mid.individual.net...
> On 19-01-24 18:43 , Jeffrey R. Carter wrote:
>> On 1/23/19 11:35 PM, Simon Wright wrote:
>>> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>>>
>>>> Such rules also commonly say that such types should not be used as
>>>> array index types, because of the possible introduction of gaps in the
>>>> array representations.
>>>
>>> Not, it seems, with GNAT:
>>
>> This is not a language rule. I can find nothing in the ARM about
>> disallowing such types as array indices. So naturally GNAT and all other
>> compilers must support it.
>
> All compliant compilers, yes. But the question was: if the enumerated 
> index type has gaps in its representation, can there be corresponding gaps 
> (unused intervals of storage units) between the elements of the array, as 
> represented in memory? Or must the elements still be contiguous, except 
> for alignment padding?
>
> In other words, can the compiled code compute the offset of an array 
> element directly from the representation of the enumerated index value 
> (causing gaps in the array), or must it always first compute the position 
> number of that value, and then compute the offset from the position number 
> (suppressing gaps)?
>
> This discussion has not yet pointed to an ARM rule that forbids gaps in 
> the array's representation.

There's no language rule of course, but more a practical one: operations 
like slicing and sliding become challenging if the array has gaps. And you 
don't get to ignore those just 'cause they're hard.

                      Randy.


  parent reply	other threads:[~2019-01-24 21:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 10:05 Problem with Position of the enumeration Type Luis Ladron de Guevara Moreno
2019-01-23 10:33 ` AdaMagica
2019-01-23 10:55   ` AdaMagica
2019-01-23 12:08   ` Luis Ladron de Guevara Moreno
2019-01-23 12:15     ` Karl Müller
2019-01-23 21:50     ` Niklas Holsti
2019-01-24  8:06     ` AdaMagica
2019-01-23 11:32 ` Mark Lorenzen
2019-01-23 12:30   ` Luis Ladron de Guevara Moreno
2019-01-23 20:22     ` Shark8
2019-01-24  8:13       ` AdaMagica
2019-01-23 17:06 ` Simon Wright
2019-01-23 22:54   ` Randy Brukardt
2019-01-23 23:47     ` Keith Thompson
2019-01-24  4:34       ` Keith Thompson
2019-01-24  9:11         ` Simon Wright
2019-01-24 21:41       ` Randy Brukardt
2019-01-23 21:42 ` Niklas Holsti
2019-01-23 22:35   ` Simon Wright
2019-01-23 23:20     ` Niklas Holsti
2019-01-24 16:43     ` Jeffrey R. Carter
2019-01-24 19:39       ` Niklas Holsti
2019-01-24 20:29         ` Jeffrey R. Carter
2019-01-24 21:43         ` Randy Brukardt [this message]
2019-01-26  9:44   ` G.B.
replies disabled

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