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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,653642c0bd258f9f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.223.84 with SMTP id ij20mr7818494qab.5.1347387104984; Tue, 11 Sep 2012 11:11:44 -0700 (PDT) Received: by 10.52.33.34 with SMTP id o2mr3211863vdi.12.1347387104915; Tue, 11 Sep 2012 11:11:44 -0700 (PDT) Path: da15ni3445qab.0!nntp.google.com!v8no203935qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 11 Sep 2012 11:11:44 -0700 (PDT) In-Reply-To: <97ff13ad-308a-416f-a300-6c7d9da3d71b@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=91.7.123.251; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 91.7.123.251 References: <97ff13ad-308a-416f-a300-6c7d9da3d71b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: 'Size of an object From: AdaMagica Injection-Date: Tue, 11 Sep 2012 18:11:44 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-09-11T11:11:44-07:00 List-Id: On Tuesday, September 11, 2012 5:52:03 PM UTC+2, Adam Beneschan wrote: > The question has to do with X'Size where X is an object. RM 13.3(40) > says this "denotes the size in bits of the representation of the > object". Maybe I'm being dense, but this doesn't seem to clarify > things. > > Suppose you have an enumeration type with eight literals, and no other > representation or aspect clauses apply to the type: > > type Enum is (E0, E1, E2, E3, E4, E5, E6, E7); > > I think Enum'Size should be 3 in most or all implementations. It must be 3. Take Integer, for instance. For the subtype Natural'Size = Integer'Size -1, because it doesn't need the sign bit. This was a much disputed decision during the Ada9X process (Ada 83 compilers had different values for 'Size, and Ada9X fixed this - it was on Tucker Taft's vote IIRM). GNAT implemented therefore the 'Object_Size attribute. Now stand-alone objects normally have a size fitting in a standard word depending on the OS. The RM says, T'Size is used for objects in packed records and Unchecked_Conversion only.