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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99bdd3ab705f1a6a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-04 23:42:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Pragma Import on arrays in record types Date: Tue, 5 Nov 2002 08:35:23 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1036482122 70512 137.194.161.2 (5 Nov 2002 07:42:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 5 Nov 2002 07:42:02 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: qLoc3PlVzCtI3iE68BIUtg== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:30374 Date: 2002-11-05T08:35:23+01:00 > Record_1 : Record_Type; > Record_2 : Record_Type; > > -- pragma import(Ada, Device_2); <-- Record_2 I presume? > > for Record_2'Address use Record_1'Address; You do not say which error message you get. But fact is that the last staement above is not required to be accepted by the RM. You should instead write: Record_1_Address: constant System.Address := Record_1'Address; for Record_2'Address use Record_1_Address; This looks nearly the same (in fact you'll ask where the difference is), but this has to be accepted according to the RM. To quote Robert Dewar: The big difference is that the first form is not reqiured to be accepted by the RM, and the second form is required to be accepted. The first form can lead to circularities, the most obvious being: X, Y : Integer; for X'Address use Y'Address; for Y'Address use X'Address; The second form with constant, the form required to be accepted by the RM, can never lead to such circularities. The discussion in the AARM further discusses why the RM restriction is there. Pragma Import should be used with overlays to prevent initialization. But why the heck do you want to overlay two objects of the same type? A renaming statement seems more appropriate in this case. Pragmas Import and Export are hideous in that they allow to undermine the Ada type concept.