From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Problem with Position of the enumeration Type Date: Thu, 24 Jan 2019 15:43:53 -0600 Organization: JSA Research & Innovation Message-ID: References: <3d782720-227d-4d86-b403-eacbd1b9d0d2@googlegroups.com> Injection-Date: Thu, 24 Jan 2019 21:43:54 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="7869"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:55365 Date: 2019-01-24T15:43:53-06:00 List-Id: "Niklas Holsti" 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 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.