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!news2.google.com!news.germany.com!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line and wildcards Date: Mon, 26 Feb 2007 18:34:01 -0600 Organization: Jacob's private Usenet server Message-ID: References: <45dcaed8_6@news.bluewin.ch> <1172132169.423514.271890@s48g2000cws.googlegroups.com> <45E1B7AA.30804@obry.net> <1dpvltpykld8r$.1rn2ewhc0itjt$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1172536337 19815 69.95.181.76 (27 Feb 2007 00:32:17 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 27 Feb 2007 00:32:17 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Xref: g2news2.google.com comp.lang.ada:9567 Date: 2007-02-26T18:34:01-06:00 List-Id: "Hyman Rosen" wrote in message news:yStEh.6202$iF.2036@trndny03... ... > There ought to be a Get_Line which returns an Unbounded_String (did > I get that right?), so that space for it comes from the heap instead > of the stack. There is such a Get_Line (see A.10.12). But I don't think that really helps. > And yes, I know it's a security issue because someone > can feed the program unbounded input and have it chew up large chunks > of RAM, but sometimes you really do need unbounded lengths on your > input lines. I've often posted the example of a .newsrc file I had > where a line of interest was well over 100,000 characters long. ...and you know why. Note that a regular unconstrained String returned from a function is allocated from the heap in Janus/Ada (we only allocate static-sized things on the stack). But that doesn't help either. The problem is that if it doesn't fit, you can't recover because there is no way to know how much of the file was read before you ran out of memory. Of course, if you don't want to recover, it's not an issue - so it makes sense to have both possibilities. And in neither case (String or Unbounded_String) is the memory going to disappear - it will get recovered quickly. (There is a danger that the momentary lack of memory could cause some other task in the program to fail - so again you do have to think about the consequences.) Randy.