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,653642c0bd258f9f,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.74.40 with SMTP id q8mr3315373pav.19.1347378723623; Tue, 11 Sep 2012 08:52:03 -0700 (PDT) Received: by 10.68.238.201 with SMTP id vm9mr1346333pbc.6.1347378723607; Tue, 11 Sep 2012 08:52:03 -0700 (PDT) Path: a8ni4572pbd.1!nntp.google.com!4no1059344pbn.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 11 Sep 2012 08:52:03 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <97ff13ad-308a-416f-a300-6c7d9da3d71b@googlegroups.com> Subject: 'Size of an object From: Adam Beneschan Injection-Date: Tue, 11 Sep 2012 15:52:03 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-09-11T08:52:03-07:00 List-Id: I had a customer ask a simple question and found that I didn't really know the answer, and I'm not even sure where there is a clear answer. 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. Now suppose you have a local variable of that type: procedure Proc is E : Enum; begin Put_Line (Integer'Image (E'Size)); end Proc; What would you expect E'Size to be, and why? In a larger procedure, what might you use 'Size on a local variable for; if you wouldn't ever use it on a local variable, then what kinds of *objects* (not types or subtypes) might you apply 'Size to, and what would you do with the value? -- thanks, Adam