From: "Grein, Christoph" <christoph.grein@eurocopter.com>
Subject: Re: Pragma Import on arrays in record types
Date: Tue, 5 Nov 2002 08:35:23 +0100 (MET)
Date: 2002-11-05T08:35:23+01:00 [thread overview]
Message-ID: <mailman.1036482121.7270.comp.lang.ada@ada.eu.org> (raw)
> 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.
next reply other threads:[~2002-11-05 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-05 7:35 Grein, Christoph [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-11-05 7:13 Pragma Import on arrays in record types Sebastian
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox