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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.52.113.232 with SMTP id jb8mr30985952vdb.13.1435943467984; Fri, 03 Jul 2015 10:11:07 -0700 (PDT) X-Received: by 10.140.94.19 with SMTP id f19mr378635qge.23.1435943467955; Fri, 03 Jul 2015 10:11:07 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!s91no806187qgd.1!news-out.google.com!4ni38095qgh.1!nntp.google.com!s91no806185qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 3 Jul 2015 10:11:07 -0700 (PDT) In-Reply-To: <864mllqv7c.fsf@stephe-leake.org> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.99.95.58; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 83.99.95.58 References: <9894cde7-2cf8-4060-be65-857812ad7b09@googlegroups.com> <17436268-aceb-461f-bdcf-eee8436cd0e6@googlegroups.com> <86y4jaqzdx.fsf@stephe-leake.org> <86oak5qulb.fsf@stephe-leake.org> <86k2usq66p.fsf@stephe-leake.org> <864mllqv7c.fsf@stephe-leake.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: What do you think about this? From: Laurent Injection-Date: Fri, 03 Jul 2015 17:11:07 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 3193 X-Received-Body-CRC: 3066686295 Xref: news.eternal-september.org comp.lang.ada:26581 Date: 2015-07-03T10:11:07-07:00 List-Id: On Friday, 3 July 2015 14:31:05 UTC+2, Stephen Leake wrote: > He should not be using a bounded string type; that's the point. > > Using a bounded string always involves a hidden length limit; if it's > too small, you'll hit it sometime, if it's too big, you're wasting storage. > > -- > -- Stephe So you mean that I should do it using something like this? Is an example from my Ada 95 book. with Ada.Text_IO; procedure General_Access_Types is type String_Pointer is access all String; -- all makes String_Pointer a "general access type" as opposed -- to a "pool-specific access type". String_Pointer values can -- designate declared variables and constants, as well as -- dynamically allocated (new) values Prompt_1 : aliased String := "Enter a command >"; Prompt_2 : aliased String := "Thank you."; Prompt_3 : aliased String := "Invalid; try again."; Prompt_4 : aliased String := "Bye now."; -- aliased means "able to be designated by a general access value" Prompt_Table : array (1 .. 4)of String_Pointer := (Prompt_1'Access, Prompt_2'Access, Prompt_3'Access, Prompt_4'Access); -- we fill the array with access values: for example, Prompt_1'Access -- returns an access value designating Prompt_1 begin -- General_Access_Types -- display all the prompts in the table for Which in Prompt_Table'Range loop Ada.Text_IO.Put (Item => Prompt_Table (Which).all); -- dereference Ada.Text_IO.New_Line; end loop; end General_Access_Types; Thanks Laurent