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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f924a751f0e5a4b3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada83/95 Compatibility References: <1134499582.913837.213460@g43g2000cwa.googlegroups.com> In-Reply-To: <1134499582.913837.213460@g43g2000cwa.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 14 Dec 2005 06:18:03 GMT NNTP-Posting-Host: 67.3.221.53 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1134541083 67.3.221.53 (Tue, 13 Dec 2005 22:18:03 PST) NNTP-Posting-Date: Tue, 13 Dec 2005 22:18:03 PST Xref: g2news1.google.com comp.lang.ada:6876 Date: 2005-12-14T06:18:03+00:00 List-Id: jeff@thecreems.com wrote: > type My_Big_Int is range -2**31 .. 2**31 -1 ; > for My_Big_Int'size use 32; > > subtype little_range is My_Big_Int range 0 .. 255; > > A : My_Big_Int; > B : Little_Range; > > I was not surprised that Little_Range'size = 8 > > What surprised me was that b'size comes back as 8. I've re-read the > representation chapter again and I think the compiler is probably > within its rights to do this. This seems correct to me. A value of subtype Little_Range can be stored in 8 bits (hence its 'Size is 8). What's important is that operations on values of Little_Range are done using My_Big_Int'Base. If you need to store a value in 32 bits (for interfacing to HW, for example) but be sure it's in Little_Range, you can always specify the 'Size of the object: X : Little_Range; for X'Size use My_Big_Int'Size; -- Jeff Carter "I soiled my armor, I was so scared." Monty Python & the Holy Grail 71