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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.160.212 with SMTP id j203mr1793429ioe.70.1504710135224; Wed, 06 Sep 2017 08:02:15 -0700 (PDT) X-Received: by 10.36.246.203 with SMTP id u194mr445ith.2.1504710134990; Wed, 06 Sep 2017 08:02:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder4.usenet.farm!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!k189no366774itk.0!news-out.google.com!c139ni465itb.0!nntp.google.com!127no367875itw.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 6 Sep 2017 08:02:14 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.10.114.9; posting-account=NT38RwoAAAB4_OO_uw8yHtNaa9Hkjukk NNTP-Posting-Host: 193.10.114.9 References: <4dc188de-802b-41ad-9cdd-b8246eb9a1c7@googlegroups.com> <47cc6474-8b75-4644-92d0-bd1f694c20e7@googlegroups.com> <338b355a-dee4-4c73-b00e-09d9a8430fb1@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language From: =?UTF-8?B?Sm9oYW4gU8O2ZGVybGluZCDDhXN0csO2bQ==?= Injection-Date: Wed, 06 Sep 2017 15:02:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47948 Date: 2017-09-06T08:02:14-07:00 List-Id: On Sunday, September 3, 2017 at 3:30:23 AM UTC+2, Randy Brukardt wrote: > "Johan S=C3=B6derlind =C3=85str=C3=B6m" wrote in me= ssage=20 > news:338b355a-dee4-4c73-b00e-09d9a8430fb1@googlegroups.com... > ... > >procedure Algorithm (Item : Integer_Array) is > > use Ada.Assertions; > > X : Integer_Array (0 .. Item'Length - 1) with Address =3D> Item'Addres= s; >=20 > The use of address clauses other than for interfacing is evil (and not=20 > guaranteed to work in the case of overlaying Ada code). Don't do that. >=20 > You can change the bounds of an array with a type conversion to a=20 > constrained subtype, which is likely to be cheaper and not break if you= =20 > change compilers. >=20 > Randy. What do you mean with cheaper? Faster execution?, Less memory footprint? Which compiler will break my code? I do not know how Ada accesses a array element internally. But a zero index= ed array must be cheaper than a custom indexed array, see: Accessing nth element from zero indexed array: (base_address + index*element_size). Accessing nth element from a custom indexed array: (base_address + (index - first)*element_size) I do not think that accessing a element from a array is a complicated thing= and starting from a zero indexed array is even simpler, then why would a c= ompiler not guarantee such a simple thing to work?