comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: How does this look?
Date: Sun, 14 Jul 2002 19:13:47 GMT
Date: 2002-07-14T19:13:47+00:00	[thread overview]
Message-ID: <L3kY8.13$A93.12090496@newssvr13.news.prodigy.com> (raw)
In-Reply-To: _DcY8.524447$cQ3.46097@sccrnsc01

> in the body of the package and I get this...
>
>         S'Size := Cell'Max_Size_in_Storage_Elements * Max;
>         |
>      >>>Declaration Expected
>
> which seems pretty redundant as S is already declared in the spec file.
  There is no "S" in the safer_genstack spec file you posted.  There is an
S which is a parameter in the Push procedure, and another S which is a
parameter in Pop.
  Since you are getting "declaration expected", the compiler probably
thinks it's seeing an assignment statement, but in a declarative
area (before the "begin").
  When you move it, you will get another error since S'Size gives the
size of S, and thus can appear on the right side of an assignment
statement, but it doesn't let you change the size of S, which appears
to be what you are trying to do.  If a program called Push, say, with
an S that was a 32 bit pointer, and Push changed the size of S to
something else, it would take truly complicated code to handle.
If Push could change the size of the storage pool, what would happen
if it shrank the pool to a size too small for the current data - would
you want Storage_Error raised?  Would you disallow shrinking?  If
the pool could be expanded, how would using it differ from just using
a portion of the default heap, not using a special pool at all?
  If you are trying to create a separate Storage_Pool just for stacks,
of size Cell'Max_Size_in_Storage_Elements * Max, why not simplify life
and just make a stack an array of Max Items plus a Current_Top_Of_Stack
index?  Usually if you want a specific, known, amount of memory it's
best to use an array or record.  One usually uses the heap ("new ...")
when you don't know exactly how your total storage needs will divide
up among various things, or when your needs are dynamic in size, eg,
when you don't want a fixed Max.



  parent reply	other threads:[~2002-07-14 19:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-14  3:09 How does this look? Caffeine Junky
2002-07-14  3:49 ` tmoran
2002-07-14  4:51   ` Caffeine Junky
2002-07-14  7:09     ` tmoran
2002-07-14 10:46       ` Caffeine Junky
2002-07-14 17:17         ` martin.m.dowie
2002-07-14 19:13         ` tmoran [this message]
2002-07-15 22:19           ` Caffeine Junky
2002-07-17  5:08             ` Simon Wright
replies disabled

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