comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Ada Pointer Size Problem
Date: Wed, 13 Oct 2004 10:07:26 +0200
Date: 2004-10-13T10:07:26+02:00	[thread overview]
Message-ID: <219535369.f3yiO4m2UC@linux1.krischik.com> (raw)
In-Reply-To: 35f054ea.0410121044.bf19fea@posting.google.com

skidmarks wrote:

> Stephen Leake <stephen_leake@acm.org> wrote in message
> news:<mailman.269.1097458704.390.comp.lang.ada@ada-france.org>...
>> aschwarz@acm.org (skidmarks) writes:
> 
>> > 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 misspoke, perhaps sarcastically. I don't want to change pointer sizes
>   and you have gone far to explain what I'm seeing. Although the reason
>   for including the dope vector as part of an Access Type eludes me, the
>   explanation I understand. (The elusion is because it seems just as
>   reasonable to 'point' to a dope vector when specifying an access type
>   rather than including the dope vector as the Access Type.) Albeit,
>   thanks to all for the clarification between System.Address and Access
>   Type.

Actually the compiler vendors are free to choose the implementation thats
suits them best.

>> > I've thought that maybe I am getting the dope vector size associated
>> > with the String_Ptr but this really doesn't make sense.
>> 
> 
>   See above. To resolve this (type of) difficulty locally - for Ada83
>   interfaces to C primarily, we do the following:
> 
>    A_Access   := array'Access
>    B_Pointer  := array(array'First)'Address
> 
>   and for the purists, THIS IS NOT TRUE ADA, so don't flame me because
>   it's not true Ada.

I use this trick as well from time to time in Ada 95. It's faster and saves
memory. 

Even cooler:

type Ada_String is String (1.. C_String_Len);
for Ada_String'Address use C_String'Address;

With Regads

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




  parent reply	other threads:[~2004-10-13  8:07 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
2004-10-12 18:44   ` skidmarks
2004-10-13  1:23     ` Jeffrey Carter
2004-10-13  8:07     ` Martin Krischik [this message]
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