From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5072448cfe6241eb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-14 12:14:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!207.115.63.138!newscon04.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr13.news.prodigy.com.POSTED!3bae8248!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: How does this look? References: <_DcY8.524447$cQ3.46097@sccrnsc01> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 67.112.201.109 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr13.news.prodigy.com 1026674027 ST000 67.112.201.109 (Sun, 14 Jul 2002 15:13:47 EDT) NNTP-Posting-Date: Sun, 14 Jul 2002 15:13:47 EDT Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PAPDCA[S@[SPTX\JKXOFXBWR\HPCTL@XT^OBPLAH[\RSAANVUEAE[YETZPIWWI[FCIZA^NBFXZ_D[BFNTCNVPDTNTKHWXKB@X^B_OCJLPZ@ET_O[G\XSG@E\G[ZKVLBL^CJINM@I_KVIOR\T_M_AW_M[_BWU_HFA_]@A_A^SGFAUDE_DFTMQPFWVW[QPJN Date: Sun, 14 Jul 2002 19:13:47 GMT Xref: archiver1.google.com comp.lang.ada:27086 Date: 2002-07-14T19:13:47+00:00 List-Id: > 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.