* Re: GNAT 3.03 and Address Clauses
1996-04-29 0:00 GNAT 3.03 and Address Clauses Rob Pettit
@ 1996-04-29 0:00 ` Robert A Duff
1996-05-04 0:00 ` David Weller
1 sibling, 0 replies; 4+ messages in thread
From: Robert A Duff @ 1996-04-29 0:00 UTC (permalink / raw)
In article <31850E0F.136C@software.org>,
Rob Pettit <pettit@software.org> wrote:
> Device_Data : Device_Data_Type;
> Device_Address : constant System.Address
> := System.Storage_Elements.To_Address(16#FFFF_0000#);
>
> for Device_Data'Address use Device_Address;
> address_test.ads:13:32: invalid address clause for "Device_Data"
> address_test.ads:13:32: must be constant defined before "Device_Data"
> (RM 13.1(22))
Put Device_Address *before* Device_Data.
- Bob
^ permalink raw reply [flat|nested] 4+ messages in thread
* GNAT 3.03 and Address Clauses
@ 1996-04-29 0:00 Rob Pettit
1996-04-29 0:00 ` Robert A Duff
1996-05-04 0:00 ` David Weller
0 siblings, 2 replies; 4+ messages in thread
From: Rob Pettit @ 1996-04-29 0:00 UTC (permalink / raw)
I have been trying to compile the following code as an example of using the Address
clause in Ada 95:
with System.Storage_Elements;
package Address_Test is
type Device_Data_Type is record
Field_1 : Integer;
Field_2 : Integer;
end record;
Device_Data : Device_Data_Type;
Device_Address : constant System.Address
:= System.Storage_Elements.To_Address(16#FFFF_0000#);
for Device_Data'Address use Device_Address;
end Address_Test;
GNAT 3.03 subsequently gives the following error message:
address_test.ads:13:32: invalid address clause for "Device_Data"
address_test.ads:13:32: must be constant defined before "Device_Data"
(RM 13.1(22))
Can anyone provide advice for compiling this code using GNAT?
Thanks in advance!
-- Rob Pettit
--------------------------------------------------------------------
Robert G. Pettit IV
Member, Technical Staff
Software Productivity Consortium
2214 Rock Hill Road Phone: 703-742-7318
Herndon, VA 22070 E-Mail: pettit@software.org
--------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNAT 3.03 and Address Clauses
1996-04-29 0:00 GNAT 3.03 and Address Clauses Rob Pettit
1996-04-29 0:00 ` Robert A Duff
@ 1996-05-04 0:00 ` David Weller
1996-05-06 0:00 ` Robert Dewar
1 sibling, 1 reply; 4+ messages in thread
From: David Weller @ 1996-05-04 0:00 UTC (permalink / raw)
In article <31850E0F.136C@software.org>,
Rob Pettit <pettit@software.org> wrote:
[Indicated he was having trouble with this code:]
> Device_Data : Device_Data_Type;
> Device_Address : constant System.Address
> := System.Storage_Elements.To_Address(16#FFFF_0000#);
>
> for Device_Data'Address use Device_Address;
>
> end Address_Test;
>
>GNAT 3.03 subsequently gives the following error message:
> address_test.ads:13:32: invalid address clause for "Device_Data"
> address_test.ads:13:32: must be constant defined before "Device_Data"
> (RM 13.1(22))
>
>Can anyone provide advice for compiling this code using GNAT?
>Thanks in advance!
>
The solution is pretty easy, GNAT's giving you a pretty strong hint:
Device_Address : constant System.Address
:= System.Storage_Elements.To_Address(16#FFFF_0000#);
Device_Data : Device_Data_Type;
for Device_Data'Address use Device_Address;
Will compile just fine.
(Don't feel too silly, I made the same mistake about a year ago :-)
--
Visit the Ada 95 Booch Components Homepage: www.ocsystems.com/booch
This is not your father's Ada -- lglwww.epfl.ch/Ada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GNAT 3.03 and Address Clauses
1996-05-04 0:00 ` David Weller
@ 1996-05-06 0:00 ` Robert Dewar
0 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1996-05-06 0:00 UTC (permalink / raw)
Dave Weller said
"The solution is pretty easy, GNAT's giving you a pretty strong hint:
Device_Address : constant System.Address
:= System.Storage_Elements.To_Address(16#FFFF_0000#);
Device_Data : Device_Data_Type;
for Device_Data'Address use Device_Address;"
What happens here is that informally the To_Address call seems like
a static expression, even though it is not technially one. On the list
to do is to specially allow this particular non-static expression in this
context to reduce the number of cases of this kind.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-05-06 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-29 0:00 GNAT 3.03 and Address Clauses Rob Pettit
1996-04-29 0:00 ` Robert A Duff
1996-05-04 0:00 ` David Weller
1996-05-06 0:00 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox