comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: pragma Import with 'Address clause
Date: Wed, 19 Mar 2003 17:10:19 +0000 (UTC)
Date: 2003-03-19T17:10:19+00:00	[thread overview]
Message-ID: <slrnb7h93l.nt.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: uof47z4dg.fsf@nasa.gov

* Stephen Leake wrote:
> Lutz Donnerhacke <lutz@iks-jena.de> writes:
>> A common technique to reinterpret data is:
>>   a : AT;
>>   [...]
>>   b : BT;
>>   for b'Address use a'Address;
>>   pragma Import(Ada, b);
>>
>> Is the "pragma Import" really necessary? Of course, the ARM says, that
>> elaboration and definition of the imported object is externally defined. So
>> they are omitted from the Ada code itself.
>>
>> Assume BT is a record without any default expressions. Does this mean, the
>> pragma can be omitted from the source code?
>>
>> Background: Spark prohibits the use of Pragma Import on objects.
>
> I would hope Spark would prohibit the address clause as well!

Spark does handle the 'Address clause much more carefully than Ada95.
The following function is problematic in Spark for two reasons:
  - Calculating with external variables is undeterministic.
  - Imported variables might not conform the type restrictions.

function get_b return BT is
  b : BT;
  for b'Address use xxx;
begin
  return b+b;
end get_b;


> you are totally defeating the Ada type system!

No.



  reply	other threads:[~2003-03-19 17:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-19 14:12 pragma Import with 'Address clause Lutz Donnerhacke
2003-03-19 15:17 ` B0966864
2003-03-19 16:51 ` Stephen Leake
2003-03-19 17:10   ` Lutz Donnerhacke [this message]
2003-03-19 22:29     ` Rod Chapman
2003-03-21 11:13       ` Lutz Donnerhacke
2003-03-19 18:07 ` Rod Chapman
2003-03-21 11:31   ` Lutz Donnerhacke
  -- strict thread matches above, loose matches on Subject: below --
2003-03-19 16:59 Beard, Frank Randolph CIV
2003-03-19 21:03 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox