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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b1208117d36fb121 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-16 20:22:48 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: System.Address'Size - not a static integer expression? Date: 16 Apr 2002 20:22:47 -0700 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0204161922.58b2bc49@posting.google.com> References: <665e587a.0203060957.3682edf7@posting.google.com> <3C891463.C4C09795@despammed.com> <5ee5b646.0204072057.48d33742@posting.google.com> <3CB1B473.CF6E93AD@despammed.com> <5ee5b646.0204091754.5dcfd16d@posting.google.com> <3CB47947.466E0E81@despammed.com> <5ee5b646.0204121220.606ecc36@posting.google.com> <3CB74D37.973A4C19@despammed.com> <5ee5b646.0204141201.1ffab2d8@posting.google.com> <3CBAEE01.D17C2DB0@despammed.com> NNTP-Posting-Host: 205.232.38.14 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1019013768 12665 127.0.0.1 (17 Apr 2002 03:22:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 17 Apr 2002 03:22:48 GMT Xref: archiver1.google.com comp.lang.ada:22628 Date: 2002-04-17T03:22:48+00:00 List-Id: "Randy Brukardt" wrote in message news:... > The only non-scalar subtype that can be static is a > string subtype. That's rare enough that it can be > ignored. So, for practical purposes, 'Size is static only > for prefixes of static scalar subtypes (which are > most scalar subtypes). Oh oh! Now the Ada experts *are* getting confused :-) :-) Randy, 'Size of a static string subtype is NOT static. Don't you get confused by Wes misreading of para 7, which clearly only applies to static *scalar* subtypes. What are the design principles here? Basically we only want sizes to be static if the front end can easily determine them and if they are generally target independent (the generally here is qualified by the fact that of course types like Integer are target dependent and yet Integer'Size is static -- the point being that the dependence here is not on the compilers treatment of data layout, but rather on the details of the type declaration). We definitely do NOT want 'Size applied to a static string subtype to be static, since in general arrays and records are layed out by the back end of a compiler in a target dependent manner. Note that the fact that para 7 says "static scalar subtype" and not "static subtype" is not an accident, it is very deliberate :-) A long and rather involved thread for a not too complex point, but probably it has some useful byproducts. For sure I hope no one reading this thread will confuse the technical term static (expression/subtype etc) with the informal notion of known-at-compile-time. Second, it is instructive to see how important it is to read the RM carefully, and to realize that the language must be read being alert to the use of technical terms that are elsewhere defined in the RM.