comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: aliased and parameters
Date: Tue, 01 Aug 2006 01:31:25 GMT
Date: 2006-08-01T01:31:25+00:00	[thread overview]
Message-ID: <N9yzg.111006$1i1.103407@attbi_s72> (raw)
In-Reply-To: <1154372565.780568.165840@p79g2000cwp.googlegroups.com>

REH wrote:
> 
> Thanks Jeff.  recv is the standard POSIX (or BSD) socket receive
> function.  It takes a pointer.  Yes, I could use an array (as I could
> still map it to a C pointer).  The problem with this is I either have
> to move the data from its "normal" type into the array (excessive data
> movement) or I have to map the array over top of my data (which gets us
> right back to using 'Address).

I was referring to the Ada library, not the C library (in this case). 
There is, for example, a standard Ada binding to POSIX. Are you using 
it, or are you making your own binding? If the latter, you should 
probably consider the former. You might also want to look into 
AdaSockets, which is a fairly platform-independent binding to sockets.

In any case, System.Address is not a pointer. There are compilers where 
a pointer and an Address are the same; there are others where they are 
different. If portability is an issue, you should not pass an address.

Using an address to achieve an overlay is a different matter. This is a 
perfectly portable use of addresses, but not one that is recommended.

If you are building your own binding (probably not a good idea), then 
you can import the function using an out mode parameter of the desired 
type, as suggested elsewhere. If, as is likely, you need to receive many 
different types, you can write a generic to create the bindings.

-- 
Jeff Carter
"I like it when the support group complains that they have
insufficient data on mean time to repair bugs in Ada software."
Robert I. Eachus
91



  parent reply	other threads:[~2006-08-01  1:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 18:05 aliased and parameters REH
2006-07-31 18:37 ` Jeffrey R. Carter
2006-07-31 19:02   ` REH
     [not found]     ` <1154373046.777655.292010@m79g2000cwm.googlegroups.com>
2006-07-31 19:26       ` REH
2006-07-31 19:59         ` REH
2006-07-31 21:52     ` Björn Persson
2006-08-01  0:35       ` REH
2006-08-01  1:31     ` Jeffrey R. Carter [this message]
2006-08-01  2:28       ` REH
replies disabled

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