From: Alfred Hilscher <Alfred.Hilscher@icn.siemens.de>
Subject: Re: Access and alias
Date: 2000/04/06
Date: 2000-04-06T00:00:00+00:00 [thread overview]
Message-ID: <38EC8032.1284C1F0@icn.siemens.de> (raw)
In-Reply-To: 38EBBBBE.87C93900@acm.org
Jeff Carter wrote:
> If you have to pass null, access types (with convention C) work fine. If
> you don't have to pass null, in out works for procedures, and access
> parameters work for functions. All keep the type checking that addresses
> lose:
>
> -- int func (int* I);
>
> function F1 (I : System.Address) return Int;
> pragma Import (C, F1, "func");
>
> function F2 (I : access Int) return Int;
> pragma Import (C, F2, "func");
>
> I : aliased Int;
> J : Int;
> S : String := Get;
>
> ...
>
> J := F1 (I'Address); -- works as intended
> J := F1 (S'Address); -- works as not intended
> J := F2 (I'access); -- works as intended
> J := F2 (S'access); -- compilation error
OK. But I would do a little change:
Instead of:
function F2 (I : access Int) return Int;
pragma Import (C, F2, "func");
Would write
type Int_Access is access all INT;
function F2 (I : Int_Access) return Int;
pragma Import (C, F2, "func");
This avoids some problems that I had with anonymous access types.
next prev parent reply other threads:[~2000-04-06 0:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-04 0:00 Access and alias NANCY HEHIR
2000-04-04 0:00 ` tmoran
2000-04-04 0:00 ` Laurent Guerby
2000-04-04 0:00 ` NANCY HEHIR
2000-04-04 0:00 ` Laurent Guerby
2000-04-05 0:00 ` Alfred Hilscher
2000-04-05 0:00 ` Laurent Guerby
2000-04-05 0:00 ` Ted Dennison
2000-04-05 0:00 ` Jeff Carter
2000-04-06 0:00 ` Alfred Hilscher [this message]
2000-04-07 0:00 ` Jeff Carter
2000-04-06 0:00 ` Robert Dewar
2000-04-07 0:00 ` Jeff Carter
2000-04-06 0:00 ` tmoran
2000-04-07 0:00 ` Robert Dewar
2000-04-07 0:00 ` tmoran
2000-04-09 0:00 ` Robert Dewar
2000-04-09 0:00 ` tmoran
2000-04-10 0:00 ` Jack W. Sharer
2000-04-06 0:00 ` Robert Dewar
2000-04-05 0:00 ` Jeffrey D. Cherry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox