From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81b62fa6e95ab58b X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: aliased & packed? Date: 1997/05/11 Message-ID: #1/1 X-Deja-AN: 240974408 References: <5l5llv$4e@lotho.delphi.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-11T00:00:00+00:00 List-Id: 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.