comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Ada Pointer Size Problem
Date: 10 Oct 2004 21:38:10 -0400
Date: 2004-10-10T21:38:10-04:00	[thread overview]
Message-ID: <mailman.269.1097458704.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <35f054ea.0410101150.25bec2f5@posting.google.com>

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




  reply	other threads:[~2004-10-11  1:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-10 19:50 Ada Pointer Size Problem skidmarks
2004-10-11  1:38 ` Stephen Leake [this message]
2004-10-12 18:44   ` skidmarks
2004-10-13  1:23     ` Jeffrey Carter
2004-10-13  8:07     ` Martin Krischik
2004-10-13 16:27     ` Jean-Pierre Rosen
2004-10-11  5:18 ` Jeffrey Carter
2004-10-21  1:16   ` Dave Thompson
2004-10-21  1:56     ` Jeffrey Carter
2004-10-21  9:54       ` Martin Krischik
2004-10-22  1:09         ` Jeffrey Carter
2004-10-22  7:48           ` Martin Krischik
2004-10-22  9:41             ` Adrien Plisson
2004-10-22 16:50               ` Warren W. Gay VE3WWG
2004-10-24 16:05               ` Martin Krischik
2004-10-23  1:35             ` Jeffrey Carter
2004-10-24 15:52               ` Martin Krischik
2004-10-22  5:41       ` Simon Wright
2004-10-22 18:05       ` Mark Lorenzen
2004-11-01  8:14       ` Dave Thompson
2004-10-11  8:45 ` Martin Krischik
     [not found]   ` <1c2f5137.0410130505.57e03c@posting.google.com>
2004-10-13 13:37     ` Dmitry A. Kazakov
2004-10-14  3:46     ` Steve
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox