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.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18a1da27baade824 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-16 18:14:16 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "David Botton" Newsgroups: comp.lang.ada Subject: Re: A copy question.... Date: Tue, 16 Oct 2001 21:14:11 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <2d87db3f.0110160209.4c6f55c2@posting.google.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:14767 Date: 2001-10-16T21:14:11-04:00 List-Id: I was showing my "favorite" method. The use of the 'Img was part of the test driver. It is a convenience that I am surprised has not been adopted by other vendors. I admit that since most of my Ada programming is with GNAT, I get lazy about portability to other compilers. Here is a more universal version: with Ada.Text_IO; use Ada.Text_IO; with System.Address_To_Access_Conversions; with System; with Interfaces; procedure Block is type My_Array is array (Integer range <>) of Interfaces.Unsigned_32; Stuff_In_Memory : My_Array (1 .. 200) := (others => 999); Address : System.Address := Stuff_In_Memory (1)'Address; Data_Length : Natural := Stuff_In_Memory'Length; -- Assuming of Unsigned_32s type The_Array is new My_Array (1 .. Data_Length); pragma Pack (The_Array); package Array_Copier is new System.Address_To_Access_Conversions (The_Array); Copied_Array : The_Array := Array_Copier.To_Pointer (Address).all; begin for N in Copied_Array'Range loop Put_Line (Interfaces.Unsigned_32'Image (Copied_Array (N))); end loop; end Block; wrote in message news:t74z7.24114$gT6.15011939@news1.rdc1.sfba.home.com... > Speaking of portability, > > function To_Pointer_To_The_Array is > > new Ada.Unchecked_Conversion (System.Address, Pointer_To_The_Array); > is not portable, while > package System.Address_To_Access_Conversions > is specifically designed to do what you want. > > Put_Line (Copied_Array (N)'Img); > The 'Img attribute is a "vendor special", 'Image would be portable.