comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: ANN: GMGPL Claw Page
Date: Wed, 1 May 2002 13:50:57 -0500
Date: 2002-05-01T13:50:57-05:00	[thread overview]
Message-ID: <ud0eau1t6f4id4@corp.supernews.com> (raw)
In-Reply-To: 4519e058.0205010856.191542a4@posting.google.com

Ted Dennison wrote in message
<4519e058.0205010856.191542a4@posting.google.com>...
>tmoran@acm.org wrote in message
news:<9gBz8.4052$wr1.2380283950@newssvr21.news.prodigy.com>...
>>   Claw uses 'access', not system.address, which is not, in fact,
always
>> the same thing as a C pointer.
>
>Right. I seem to rememer a discussion here a long time ago, where the
>general conclusion was that, while in theory there is no guarantee
>System.Adress is implemented in any specific way, in practice
>System.Address is more likely to match up with a C pointer than an
>access type is.


No, that's wrong. If you want a C pointer in your Ada program, all you
need to do is declare one:

    type Access_Whatever is access Whatever;
    pragma Convention (C, Access_Whatever);

If a compiler accepts this and doesn't give you an access type
compatible with a C pointer, you've got a seriously buggy compiler! Best
find a different one. A compiler might reject it, depending on what
Whatever is, but that generally doesn't happen.

One a few targets (like the Unisys 2200 compiler we did), Ada accesses
and C pointers don't have the same representation. (C pointers are bit
pointers on that machine, and we didn't want to pay for that when we
didn't need it in Ada.)

>I think the only place I ever use it any more is in bindings (where
>you are generally at a icky low level anyway). However, I'd have to
>check my code to see exactly where it is used. I know I'm rather
>liberal with Addresses on unused pointer parameters, but I can't
>remember how I was doing *used* pointer parameters. I'm pretty sure I
>don't make much use of Interfaces.C.Pointers. Perhaps that's a bad
>move?


No, using the above is just as good. Just be sure to (somehow) declare
that you want a C pointer. As far as "unused" pointer parameters go, we
just use Claw.DWord for that on Claw. That is the right size, and
portability to another OS is not an issue for Claw.

>Anyway, the possible issues with System.Address is why I mentioned it.
>I'm certianly willing to learn the proper portable way to get at C
>pointers, and from the looks of things, the folks who wrote Claw would
>know a thing or two about portability. :-)


At least between Windows platform compilers...

          Randy.






  reply	other threads:[~2002-05-01 18:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-28  5:03 ANN: GMGPL Claw Page David Botton
2002-04-28  6:58 ` Jason King
2002-04-28  8:05 ` David Botton
2002-04-29 15:15 ` ANN: " Ted Dennison
2002-04-29 18:07   ` David Botton
2002-04-29 20:21     ` Randy Brukardt
2002-04-29 22:42       ` tmoran
2002-04-30  3:42         ` David Botton
2002-04-30 13:27         ` Ted Dennison
2002-04-30 18:20           ` tmoran
2002-05-01 16:56             ` Ted Dennison
2002-05-01 18:50               ` Randy Brukardt [this message]
2002-04-30 13:49       ` Ted Dennison
2002-05-01 12:51         ` Robert Dewar
2002-05-01 18:22         ` tmoran
replies disabled

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