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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,61006929d3e14455 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada Pointer Size Problem Date: 10 Oct 2004 21:38:10 -0400 Organization: Cuivre, Argent, Or Message-ID: References: <35f054ea.0410101150.25bec2f5@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1097458705 17157 212.85.156.195 (11 Oct 2004 01:38:25 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 11 Oct 2004 01:38:25 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <35f054ea.0410101150.25bec2f5@posting.google.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:5021 Date: 2004-10-10T21:38:10-04:00 aschwarz@acm.org (skidmarks) writes: > I have a problem with the test program below. Perhaps someone can help me. > > 1. P1_Size gives an error. P2_Size and P3_Size don't. > I would have expected errors everywhere or nowhere. > I don't understand what is 'non-static' about the > expression since a typedef is invariant. Gnat 5.02a1 says: junk.adb:9:35: non-static expression used in number declaration junk.adb:9:45: size attribute is only static for scalar type (RM 4.9(7,8)) junk.adb:13:35: non-static expression used in number declaration junk.adb:13:54: "P2_Size" is not static constant or named number (RM 4.9(5)) In general 'static' means "known at compile time", but the details in the RM sometimes deviate from that simple description. The reasons have to do with making the compiler easier to right, mostly. I think Ada 2005 will be making more things static. > 3. The string pointer size (eliding the error statements) > is 64-bits. I am using an AMD 2100 (32-bit) computer > and gcc-3.3.3-3. I would have expected a 32-bit > pointer. Just shows the compiler knows better than you do :). A pointer to an unconstrained array also needs a 'dope vector', that stores the bounds of the array. > 4. The integer pointer size (eliding the error statements) > is 32-bits. I would have expected that it would be the > same size as the string pointer. > > I've looked at the 'info' tex file included with the > gcc distribution and so far have not found how to > change a 64-bit pointer to a 32-bit pointer. Why do you want to do that? A pointer to an integer is not a pointer to a string. > I've thought that maybe I am getting the dope vector size associated > with the String_Ptr but this really doesn't make sense. Why doesn't that make sense? > The Integer_Ptr is only 32-bits which seems to be correct but both > pointers should be the same. Why? -- -- Stephe