comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: aliased & packed?
Date: 1997/05/11
Date: 1997-05-11T00:00:00+00:00	[thread overview]
Message-ID: <dewar.863401335@merv> (raw)
In-Reply-To: 5l5llv$4e@lotho.delphi.com


Tom Moran said

<<  It was suggested that 'address be used instead of 'access.  Do the
rules of Ada say that should always work, on any compiler, for an
Imported function?  Clearly 'address and 'access are not normally
assumed identical (or there would be no point to
System.Address_To_Access_Conversions).>>

Well, address is very precisely defined in terms of storage units
occupied, so its meaning, though target dependent of course, should
certainly be compiler independent assuming the same data layouts.

Note this assumption, there is nothing in Ada that specifies the
mapping of array elements, so any time you make an assumption about
this, you are writing implementation dependent code.

In the case of packed arrays, since none of the languages you are
interfacing to support packed arrays, pragma Convention does not
help to guarantee the order.

Obviously you definitely CANNOT expect access to work on a packed array.
This in fact is a good example of why access values and pointers are
totally different. In writing 'access of a packed aliased array element
and expecting it to work, you are making the typical mistake of thinking
of the 'access as being a pointer, and assuming that the pointer is 
implemented as an address.

It is quite clear that 'Address is *far* more appropriate in any case
for the use you have in mind, and is exactly at the right level of
abstraction.





  reply	other threads:[~1997-05-11  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-11  0:00 aliased & packed? tmoran
1997-05-11  0:00 ` Robert Dewar [this message]
1997-05-11  0:00   ` Tom Moran
1997-05-12  0:00     ` Robert Dewar
1997-05-12  0:00       ` Robert A Duff
     [not found]         ` <1997May13.065907.1@eisner>
1997-05-13  0:00           ` Robert A Duff
1997-05-13  0:00             ` Larry Kilgallen
1997-05-14  0:00             ` Richard Kenner
1997-05-13  0:00           ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-05-09  0:00 Tom Moran
1997-05-09  0:00 ` Stephen Leake
1997-05-09  0:00   ` Tom Moran
1997-05-10  0:00 ` Robert Dewar
replies disabled

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