comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: An alternative to Unchecked Conversion
Date: 1999/12/17
Date: 1999-12-17T00:00:00+00:00	[thread overview]
Message-ID: <x7v902txlla.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: mhrj5s4qckk7rt1j3pu0s3r438e281pu37@4ax.com

Brian Orpin <abuse@borpin.co.uk> writes:

> Well the Tartan Ada (83) compiler we are using doesn't allow us to use
> address mapping as it requires all address statements to be static.
> 
> With SYSTEM;
> Use SYSTEM;
> 
>   Procedure TEST Is
>      Type TEST_TYPE Is New INTEGER;
>      For TEST_TYPE'Size Use 32;
> 
>      X : TEST_TYPE;
>      Y : TEST_TYPE;
>      For X Use At Y'Address;
> 
>   Begin
> 
>      X := 1;
> 
>   End TEST;
> 
>    9|     Y : TEST_TYPE;
> test.ada:10:1:
>   10|     For X Use At Y'Address;
>                         ^1
> ***  1 Error 3271: A static expression is expected here (RM83 4.9)

I was expecting GNAT to complain similarly about this but neither
3.11p nor 3.12a2 does, so clearly I haven't understood.

Under similar circumstances, the typical solution is like

     X : TEST_TYPE;
     Y : TEST_TYPE;
     Y_Address : constant Address := Y'Address;
     For X'Address  Use Y_Address;

(Brian, are you still using 83? because "For X Use At Y'Address" is an
83-ism)




  parent reply	other threads:[~1999-12-17  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-16  0:00 An alternative to Unchecked Conversion Tom_Hargraves
1999-12-16  0:00 ` Mark A Biggar
1999-12-16  0:00 ` Matthew Heaney
1999-12-16  0:00   ` Richard D Riehle
1999-12-17  0:00     ` Ted Dennison
1999-12-17  0:00       ` Richard D Riehle
1999-12-16  0:00   ` Tom Hargraves
1999-12-16  0:00     ` DuckE
1999-12-16  0:00     ` Matthew Heaney
1999-12-17  0:00       ` Lutz Donnerhacke
1999-12-17  0:00         ` Matthew Heaney
     [not found]     ` <mhrj5s4qckk7rt1j3pu0s3r438e281pu37@4ax.com>
1999-12-17  0:00       ` Simon Wright [this message]
     [not found]         ` <g9rr5s84eeov4vvp2v9v70jo9b5uporm0v@4ax.com>
1999-12-20  0:00           ` Simon Wright
1999-12-23  0:00             ` Robert Dewar
1999-12-18  0:00       ` Rex Reges
1999-12-18  0:00         ` Matthew Heaney
1999-12-19  0:00         ` Robert Dewar
1999-12-20  0:00     ` Charles H. Sampson
1999-12-16  0:00 ` Jeff Creem
replies disabled

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