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,start X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: aliased & packed? Date: 1997/05/11 Message-ID: <5l5llv$4e@lotho.delphi.com>#1/1 X-Deja-AN: 240942683 Organization: Delphi Internet Services Newsgroups: comp.lang.ada Date: 1997-05-11T00:00:00+00:00 List-Id: >take the access of a packed array, but then the *array* needs to be >aliased, not its components. The components only need to be aliased >if you need the access of individual array elements, but clearly that >makes no sense if the elements are on arbitrary bit boundaries. Given type Image_type is array(0 .. last_row, 0 .. last_col) of aliased BW_Bit_type; pragma Pack(Image_Type); If you want to pass, say, the right half of the fifth scan line, The_Image(4, 320 .. 639), which is done in Windows by passing the address of The_Image(4,320). (320 being divisible by 8) Or look at ARM B.3(23), where char_array is defined as a packed array of aliased 'char'. Is this different except in the empirical sense that on most machines a char is addressable and a bit is not? Having been bitten in the past by passing an array to an external function, and finding the external function looking at a descriptor when it thought it was looking at the first data element, my coding style has evolved to pass the address of the first data element instead. Is this no longer necessary with any correct Ada 95 compiler? 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).