comp.lang.ada
 help / color / mirror / Atom feed
From: pa.dec.com!nntpd2.cxo.dec.com!bonmot!wallace@decwrl.dec.com  (Richard Wal
Subject: ADA Max Array Size HELP!!!!
Date: 22 Sep 92 19:06:32 GMT	[thread overview]
Message-ID: <1992Sep22.190632.7116@nntpd2.cxo.dec.com> (raw)

mgeorgy@vmsclst1.sc.csupomona.edu writes:
: I am having trouble figuring out how array sizes are determined, or should I
: say what the largest size possible if???  I know that this involves the amoun
t
: of memory the computer has, but how, is it measured by INTEGER'LAST, and if s
o
: how does this figure into a multi-dimentional Array, or Matrix.
: 
: Basicaly this is what I am trying to do:
: type TEST is array (1..512, 1..512) of TYPE;
: but it won't let me, why not???
: 
: Thanx,
: Matt Georgy

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
<wallace@cookie.enet.dec.com>

	"The opinions expressed are my own, Unlce Ken or Uncle Bob
	 may, or may not, agree with me.

             reply	other threads:[~1992-09-22 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-22 19:06 pa.dec.com!nntpd2.cxo.dec.com!bonmot!wallace [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-09-23 19:36 ADA Max Array Size HELP!!!! Dave Marshall
replies disabled

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