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!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Arrays in Ada 2012 Date: Wed, 7 Jun 2017 14:15:38 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <35c6ac5a-3295-4fa4-8545-ca76c113dde4@googlegroups.com> <6f8707d3-a5a2-48f2-8c16-8eed3fa333f9@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:46911 Date: 2017-06-07T14:15:38+02:00 List-Id: On 07/06/2017 13:47, Anatoly Chernyshev wrote: > On Wednesday, June 7, 2017 at 7:06:13 PM UTC+12, Dmitry A. Kazakov wrote: >> On 06/06/2017 22:56, Randy Brukardt wrote: >> >>> Current := Current + Long_Long_Integer'Size/Storage_Unit; >> >> A bit OT question. >> >> I always use rounding in the corresponding cases >> >> (Long_Long_Integer'Size + Storage_Unit - 1) / Storage_Unit; >> >> Is this an overkill from the point of view the permissions RM gives to >> array implementation? > > Miserable life of a computer scientist... > > Couple of minor questions: > > 1 (to Dmitry): Aren't you screwing up the whole idea when using plain '1' in the formula above? It is no problem, integer literals are kind of overloaded. The expression above is of universal integer type until it gets forced into the target type, Storage_Offset in the case of address arithmetic. BTW, if you don't like constant you could use this instead: (Long_Long_Integer'Size + Storage_Offset'Pred (Storage_Unit)) / Storage_Unit; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de