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,92f1b9f519795959 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.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: pragma Convention ignored (sometimes) References: <1131029395.700984.154230@f14g2000cwb.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 04 Nov 2005 05:19:13 GMT NNTP-Posting-Host: 67.3.210.212 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1131081553 67.3.210.212 (Thu, 03 Nov 2005 21:19:13 PST) NNTP-Posting-Date: Thu, 03 Nov 2005 21:19:13 PST Xref: g2news1.google.com comp.lang.ada:6174 Date: 2005-11-04T05:19:13+00:00 List-Id: Anonymous Coward wrote: > type Some_Enum_Type is (one, two, three); > > pragma Convention (Convention => C, Entity => Some_Enum_Type); > > should create a 32 bit enum, but in fact doing a 'size reveals that > it's 2 bits! By default, 'Size on a subtype gives the minimum # of bits to represent the values of the type. In this case, that would be 2. 'Size of an object is something else, and in this case is probably more like what you expect. Without the pragma Convention, I'd expect it to be 8 on x86 targets. As an example, with GNAT, Integer'Size is 32 and Natural'Size is 31. An object of subtype Natural, however, is usually 32 bits. If you explicitly define the size of a subtype (for X'Size use 23;), then 'Size on the subtype should give the defined value. -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail 07