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 X-Google-Thread: 103376,46ea53533b75e179 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-27 10:29:39 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!feed.news.tiscali.de!tiscali!newsfeed1.ip.tiscali.net!fi.sn.net!newsfeed2.fi.sn.net!news-stoc.telia.net!news-stoa.telia.net!telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: sv, en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: count_string program References: <403eb73b$1_1@news.tm.net.my> <6MB%b.69233$4o.90172@attbi_s52> In-Reply-To: <6MB%b.69233$4o.90172@attbi_s52> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Message-ID: Date: Fri, 27 Feb 2004 18:29:38 GMT NNTP-Posting-Host: 217.209.116.179 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1077906578 217.209.116.179 (Fri, 27 Feb 2004 19:29:38 CET) NNTP-Posting-Date: Fri, 27 Feb 2004 19:29:38 CET Organization: Telia Internet Xref: archiver1.google.com comp.lang.ada:5907 Date: 2004-02-27T18:29:38+00:00 List-Id: tmoran@acm.org wrote: > In the real world, you can probably assume most > users won't enter more than, say, 1,000 characters, so you could specif= y > that your program only handles a maximum of 1,000, and then declare >=20 > Input : String(1 .. 1000); You (Cecilia) could do that, but if you need to store the string it's=20 because you want to use it later. Then you will most likely need to know = how many of those 1000 positions are used and how many contain garbage.=20 That is, you have to keep track of the actual length of the string=20 separately. Since there are string types in the standard library that=20 keep track of the length automatically, it's better to use them. --=20 Bj=F6rn Persson jor ers @sv ge. b n_p son eri nu