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,e219d94b946dfc26 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line and wildcards From: Georg Bauhaus In-Reply-To: References: <45dcaed8_6@news.bluewin.ch> <1172132169.423514.271890@s48g2000cws.googlegroups.com> <45E1B7AA.30804@obry.net> <1dpvltpykld8r$.1rn2ewhc0itjt$.dlg@40tude.net> <1s55dlqncctpm$.zs9aloiw8j2l$.dlg@40tude.net> <1172509912.655684.114870@t69g2000cwt.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-ID: <1172592793.6285.13.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Date: Tue, 27 Feb 2007 17:13:13 +0100 Organization: Arcor NNTP-Posting-Date: 27 Feb 2007 17:10:52 CET NNTP-Posting-Host: 6e836695.newsspool2.arcor-online.net X-Trace: DXC=en8W]7l[=kbmW`a1fG7C`2T@AUZfC;GVQI On Mon, 2007-02-26 at 18:34 +0100, Markus E Leypold wrote: > "Hyman Rosen" writes: > > > On Feb 26, 3:44 am, "Dmitry A. Kazakov" > > wrote: > >> Further, why do you presume that heap is larger than stack? > >> AFAIK, nothing in RM requires or implies that. > > > > Past experience. If that's not the case for some implementation then > > fine, but I suspect it's more often the case then not. I'm pretty sure > > we've seen newbie examples on the newsgroup where they create > > unconstrained objects (is that the right term?) on the stack and then > > wonder why their program doesn't work. > > I'm also pretty sure that in most of those cases creating them on the > heap wouldn't work either. IIRC, two non-GNAT Ada compilers had no trouble whatsoever allocating objects of type array (1 .. N) of Something, N <= available_heap_memory, independent of the OS stack size. Also, I think Hyman remembers correctly: rewriting Ada programs to use explicit heap allocation for dynamically sized arrays can make GNAT-translated Ada programs work. I understand that Janus/Ada allocates on the heap, too, so there shouldn't be a problem either for any N below available heap memory. Really, isn't this an issue of how to best use GNAT for Ada programs when they have potentially large objects. GNAT: $ ./big Enter size: 50_000_000 size is 50000000 raised STORAGE_ERROR : big.ada:6 object too large $ AppletMagic: $ java big Enter size: 50_000_000 size is 50000000 Enter Q: q $ For the same quick and dirty program, with Ada.Text_IO; procedure big is procedure make(n: NATURAL) is local: array(1 .. n) of Character; begin if local'length > 0 then local(local'last) := local(local'length / 2); end if; end make; buffer: String(1 .. 20); last: Natural; -- dual use begin Ada.Text_IO.put("Enter size: "); Ada.Text_IO.Get_line(buffer, last); last := Integer'value(buffer(1 .. last)); Ada.Text_IO.put_line("size is" & Integer'image(last)); make(last); Ada.Text_IO.put("Enter Q: "); Ada.Text_IO.Get_Line(buffer, last); end; > Especially if the unconstrained parameter > was determining an array size and was of type Natural or Positive. > > Regards -- Markus > > >