comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Gnat For use at Question
Date: 1996/07/11
Date: 1996-07-11T00:00:00+00:00	[thread overview]
Message-ID: <dewar.837096600@schonberg> (raw)
In-Reply-To: 4s2eb5$qt6@masala.cc.uh.edu


Spasmo asks why GNAT rejects:
"Some_Array : String(1..4000);
for Some_Array use at 16#bbbbb#;"

GNAT rejects this because it is plainly illegal. Address, in accordance
with the implementation ad vice in the Ada 95 RM is a private type in
GNAT, and you obviously can't use an integer literal as the value of 
a private type.

Look up the facilities in System.Storage_Elements to find out how to
do what you want. Rememeber that GNAT implements the restriction that
the address expression must be a prior defined constant, so you cannot
just use To_Address directly, since a call to To_Address is not static.
So you want something like:

	Some_Array_Address : constant Address := To_Address (16#bbbb#);
        Some_Array : String (1 .. 4000);
        for Some_Array'Address use Some_Array_Address;

P.S. since almost certainly what you have in mind is overlaying the
display buffer, it would be much neater to have an Ada variable with
more structure (something like a two dimensional array of records
containing an attribute which is a packed record and a character).





  parent reply	other threads:[~1996-07-11  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-11  0:00 Gnat For use at Question Spasmo
1996-07-11  0:00 ` Robert A Duff
1996-07-11  0:00 ` Jerry van Dijk
1996-07-11  0:00 ` Robert Dewar [this message]
1996-07-19  0:00   ` Spasmo
1996-07-11  0:00 ` Jon S Anthony
1996-07-11  0:00   ` Robert A Duff
1996-07-12  0:00   ` Robert Dewar
1996-07-12  0:00   ` Spasmo
1996-07-12  0:00   ` Jon S Anthony
1996-07-12  0:00   ` Laurent Guerby
1996-07-13  0:00     ` Jerry van Dijk
1996-07-15  0:00     ` Spasmo
1996-07-15  0:00   ` Jon S Anthony
1996-07-15  0:00   ` Jon S Anthony
1996-07-15  0:00     ` Spasmo
1996-07-15  0:00     ` Robert Dewar
1996-07-15  0:00     ` Jerry van Dijk
replies disabled

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