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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: When to use Bounded_String? Date: Mon, 20 Nov 2017 06:38:43 +0100 Organization: Adalog Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 20 Nov 2017 05:38:40 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="497fc11935e7b7a02722d93e1b28f694"; logging-data="32547"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QyqXMWXDd5EcohLm3o6tn" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 In-Reply-To: Content-Language: fr Cancel-Lock: sha1:NcweY8lXT7mER3A+h8iD/22eWKU= Xref: feeder.eternal-september.org comp.lang.ada:49009 Date: 2017-11-20T06:38:43+01:00 List-Id: Le 19/11/2017 à 10:55, Niklas Holsti a écrit : > On 17-11-19 04:19 , Victor Porton wrote: >> What is the main purpose of Bounded_String? > > As I understand it, the purpose is to let a program use string variables > of dynamically varying length, without using dynamically allocated heap > memory. The penalty is a fixed upper bound on the length, and perhaps > more copying of characters from one variable to another (depending on > the implementation). > No, it's not just a matter of implementation. Bounded_String are a good fit for data types implemented as strings. A typical example is name, address, etc. from a person's data. These are represented as strings, you need variable length, and there is generally a maximum length (comming f.e. from the declaration in the underlying database). Note that each instantiation provides a different type, so you cannot assign a name to an address. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr