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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,653642c0bd258f9f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.88.168 with SMTP id bh8mr3042741pab.10.1347380404995; Tue, 11 Sep 2012 09:20:04 -0700 (PDT) Received: by 10.50.40.165 with SMTP id y5mr6423169igk.1.1347380404173; Tue, 11 Sep 2012 09:20:04 -0700 (PDT) Path: a8ni4572pbd.1!nntp.google.com!4no1085771pbn.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 11 Sep 2012 09:20:03 -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=71.108.121.229; posting-account=tXrPSAkAAAAFR3M1xqoK7TQdrNxOfPT0 NNTP-Posting-Host: 71.108.121.229 References: <97ff13ad-308a-416f-a300-6c7d9da3d71b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9fcf7c0f-344b-45d4-a662-5b212915efee@googlegroups.com> Subject: Re: 'Size of an object From: Micronian Coder Injection-Date: Tue, 11 Sep 2012 16:20:04 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-09-11T09:20:03-07:00 List-Id: That's a good question. I would expect it to be the size of the object, whi= ch could be anything really (8, 16, 32) and not the size of Enum'Size (ie. = 3). If I'm not mistaken, this confusion is why AdaCore implemented an Objec= t_Size attribute which sadly didn't make it into any recent version of Ada.= A quick search on www.ada-auth.org turns up http://www.ada-auth.org/cgi-bi= n/cvsweb.cgi/ais/ai-00319.txt?rev=3D1.5 , which is voted as NO ACTION. I sh= ould read the AI discussion to see what the ARG was thinking. On Tuesday, September 11, 2012 8:52:03 AM UTC-7, Adam Beneschan wrote: > I had a customer ask a simple question and found that I didn't really >=20 > know the answer, and I'm not even sure where there is a clear answer. >=20 >=20 >=20 > The question has to do with X'Size where X is an object. RM 13.3(40) >=20 > says this "denotes the size in bits of the representation of the >=20 > object". Maybe I'm being dense, but this doesn't seem to clarify >=20 > things. >=20 >=20 >=20 > Suppose you have an enumeration type with eight literals, and no other >=20 > representation or aspect clauses apply to the type: >=20 >=20 >=20 > type Enum is (E0, E1, E2, E3, E4, E5, E6, E7); >=20 >=20 >=20 > I think Enum'Size should be 3 in most or all implementations. Now suppos= e >=20 > you have a local variable of that type: >=20 >=20 >=20 > procedure Proc is >=20 > E : Enum; >=20 > begin >=20 > Put_Line (Integer'Image (E'Size)); >=20 > end Proc; >=20 >=20 >=20 > What would you expect E'Size to be, and why? In a larger procedure, >=20 > what might you use 'Size on a local variable for; if you wouldn't ever >=20 > use it on a local variable, then what kinds of *objects* (not types or >=20 > subtypes) might you apply 'Size to, and what would you do with the value? >=20 >=20 >=20 > -- thanks, Adam