comp.lang.ada
 help / color / mirror / Atom feed
From: "REH" <spamjunk@stny.rr.com>
Subject: Re: aliased and parameters
Date: 31 Jul 2006 12:02:45 -0700
Date: 2006-07-31T12:02:45-07:00	[thread overview]
Message-ID: <1154372565.780568.165840@p79g2000cwp.googlegroups.com> (raw)
In-Reply-To: <g5szg.66349$FQ1.55209@attbi_s71>


Jeffrey R. Carter wrote:
> REH wrote:
> > ...
> > recv(socket, Hdr'Address, header_size);
> >
> > The problem is that some Ada95 compiler are so aggressive with
> > optimization that they may not "see" then Hdr is changed by recv.  At
> > the very less the compiler complains (rightfully so) that Hdr is alised
> > but not marked as such.  But how do enforce that if I cannot define the
> > parameter as aliased?  Should I use an access type instead and convert
> > it to System.Address, or is there a cleaner way?
>
> You should not be using 'Address at all. I don't know the definition of
> Recv, so I can't say what would be better. If it's an interface to C,
> you might want an array or a C-compatible access value.
>
> Of course, that assumes you can change the library in question.
>
> --
> Jeff Carter
> "Death awaits you all, with nasty, big, pointy teeth!"
> Monty Python & the Holy Grail
> 20

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).

REH




  reply	other threads:[~2006-07-31 19:02 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 [this message]
     [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
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