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!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Curiosity about different integer types Date: Sat, 18 Jun 2016 23:57:11 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <63c033c6-10b5-44fc-8d93-a786392a6058@googlegroups.com> NNTP-Posting-Host: w/2xSGckQeJEFvqsQFNodA.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 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:30796 Date: 2016-06-18T23:57:11+02:00 List-Id: On 2016-06-18 23:26, mockturtle wrote: > few days ago a curiosity came to my mind. Consider this > > type Foo is new Integer range 0 .. 115; > > type Bar is new Integer range -1000 .. 1000; > > My gut feeling is that, despite the fact that they are both derived > from Integer, there is no guarantee that the "binary type" underneath > them is the same. For example, Foo could be implemented as an 8-bit > integer, while Bar could be implemented as a 16-bit integer, or maybe > both could be implemented as (say) 32-bit integers. > > Am I right? I tried to do some experiments with gcc and both types > are implemented with the same binary type, but it could be only for > efficiency reasons... No. I am not a language lawyer, but type Foo is new Integer range 0 .. 115; is a kind of abbreviation of type is new Integer; -- Clone subtype Foo is range 0..115; -- Constrain The relevant point is IMO ARM 3.4 (9) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de