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 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 16:00:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!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 19:00:47 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <9qedad$i1p$1@newstoo.ericsson.se> 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:14760 Date: 2001-10-16T19:00:47-04:00 List-Id: ----- Original Message ----- From: "Zebylon" > Is there some smart way of placing the data in the array...? This is my favorite method and if you don't need a copy, but just an easy way to access the memory, you can just use the returned Pointer_To_The_Array directly instead of copying it. I think the compiler will likely figure out the best way to make the block copy on the platform :-) with GNAT.IO; use GNAT.IO; with Ada.Unchecked_Conversion; 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; type The_Array is new My_Array (1 .. Data_Length); type Pointer_To_The_Array is access all The_Array; function To_Pointer_To_The_Array is new Ada.Unchecked_Conversion (System.Address, Pointer_To_The_Array); Copied_Array : The_Array := To_Pointer_To_The_Array (Address).all; begin for N in Copied_Array'Range loop Put_Line (Copied_Array (N)'Img); end loop; end Block;