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-Thread: 103376,7aeecd1069c28415 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s53.POSTED!53ab2750!not-for-mail From: Freejack Subject: Re: Objects and the Stack? User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table) Message-ID: Newsgroups: comp.lang.ada References: <32fv82F3l9al7U1@individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 67.164.245.153 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s53 1103313144 67.164.245.153 (Fri, 17 Dec 2004 19:52:24 GMT) NNTP-Posting-Date: Fri, 17 Dec 2004 19:52:24 GMT Organization: Comcast Online Date: Fri, 17 Dec 2004 19:52:24 GMT Xref: g2news1.google.com comp.lang.ada:7037 Date: 2004-12-17T19:52:24+00:00 List-Id: On Fri, 17 Dec 2004 11:46:11 +0000, Nick Roberts wrote: > I suppose so, but I think I should tell you now that what you trying > (above) cannot work. The assumption in Ada is that the space reserved > within a stack frame for an object cannot be resized (even though the space > used /within/ the space reserved for an object can). So the compiler must > be able to allocate the maximum size of an object on the stack. Since what > you are attempting could cause Stack to grow to any size without limit, the > compiler cannot know what maximum to allocate. It won't work, and so you > must use the heap (or more correctly, a 'storage pool'). > > Ada has no equivalent of alloca() in C. It might be interesting to > experiment with a compiler extension to provide this facility. Certain > algorithms might benefit from it. > > declare > Name: String := ""; > pragma Extensible_Object(Name); > begin > ... > Name := Name & ':'; -- changes its size > ... > > It's an idea. I think the florist bindings have an Interface to the brk() and sbrk() system calls, which is how it's usually done in C/Asm. Perhaps by declaring the Objects to be Controlled, and then putting in calls to brk() one might achieve the same effect. Freejack