Matt,
Given the code fragment above, the TYPE conflicts with the
reserved word "type" in the Ada'83 LRM.
To try and answer what I think is your real question (my rewrite),
"How much memory will my declaration consume?"
for example:
with TEXT_IO;
procedure FOO is
package MY_INT_IO is new TEXT_IO.INTEGER_IO(INTEGER); use MY_INT_IO;
type TEST is array(1..512,1..512) of INTEGER;
BAR : TEST;
begin
MY_INT_IO.PUT( INTEGER ( BAR'size / 8) ); TEXT_IO.NEW_LINE;
end FOO;
When run, the answer of 1048576 is given (for a VAX/VMS) system because
an INTEGER type is 4 bytes and a byte on this machine is 8 bits.
To figure out the storage requirements look in package SYSTEM for your
run-time system. This will list the information you need. For types of
FLOAT, "digits" and record types (exception of variants) all you need do
is figure out your systems storage elements and then do simple math to
construct the storage space requied. Remember that storage is usually not
assigned until an object of that type is declared.
For variant records, this is a *rule of thumb* and not an absolute, the
largest variant is the unit storage size for that record. Knowing that
size, then the rest is as above.
Hope this helps!
Richard Wallace
Digital Equipment Corporation
301 Rockrimmon Blvd. South
CXO2-1/7A
Colorado Springs, CO 80919-2398
(719)548-2792
<wal...@cookie.enet.dec.com>
"The opinions expressed are my own, Unlce Ken or Uncle Bob
may, or may not, agree with me.
The above instantiation is unnecessary. See below.
>
> type TEST is array(1..512,1..512) of INTEGER;
>
> BAR : TEST;
>
> begin
>
> MY_INT_IO.PUT( INTEGER ( BAR'size / 8) ); TEXT_IO.NEW_LINE;
^^^^^^^
This cast is unnecessary, BTW. 'SIZE is of type universal-integer, which
any compiler will gladly convert to whatever integer type you need it for.
Try instead:
TEXT_IO.PUT_LINE( INTEGER'IMAGE ( BAR'SIZE / 8));
>
> end FOO;
>
> When run, the answer of 1048576 is given (for a VAX/VMS) system because
> an INTEGER type is 4 bytes and a byte on this machine is 8 bits.
>
Same result on a Sun.
Here's a question for the Verdix gurus:
When I try the above program, I get a storage error exception. When I modify
it slightly to dynamically allocate the array object, no problem. What do
I need to do to get the above program without resorting to access types?
--
Dave Marshall
dmar...@stars.reston.unisys.com