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.182.28.99 with SMTP id a3mr49490893obh.18.1435090836468; Tue, 23 Jun 2015 13:20:36 -0700 (PDT) X-Received: by 10.140.85.11 with SMTP id m11mr550206qgd.29.1435090836365; Tue, 23 Jun 2015 13:20:36 -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!news.glorb.com!h15no7603633igd.0!news-out.google.com!k20ni3072qgd.0!nntp.google.com!z60no2927757qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 23 Jun 2015 13:20:36 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.36; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 149.32.224.36 References: <9894cde7-2cf8-4060-be65-857812ad7b09@googlegroups.com> <17436268-aceb-461f-bdcf-eee8436cd0e6@googlegroups.com> <86y4jaqzdx.fsf@stephe-leake.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: What do you think about this? From: Anh Vo Injection-Date: Tue, 23 Jun 2015 20:20:36 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:26445 Date: 2015-06-23T13:20:36-07:00 List-Id: On Tuesday, June 23, 2015 at 12:51:08 PM UTC-7, Laurent wrote: > On Tuesday, 23 June 2015 16:21:17 UTC+2, Stephen Leake wrote: > > I did not download and compile it, but I did browse around it a bit. > > That's why I like git. > > with Ada.Strings.Bounded; > with Ada.Strings.Fixed; > > package Common_Defs_BCI is > > V_String_Length : constant := 64; > > package V_String is new > Ada.Strings.Bounded.Generic_Bounded_Length (V_String_Length); > > function "+" (Right : V_String.Bounded_String) return String > renames > V_String.To_String; > > function "+" (Right : String) return V_String.Bounded_String > is (V_String.To_Bounded_String (Right)); > > function Trim (Right : String) return V_String.Bounded_String is > (V_String.To_Bounded_String (Ada.Strings.Fixed.Trim (Right, Ada.Strings.Both))); > > end Common_Defs_BCI; I would suggest to improve the last two functions with the following preconditions. That means any attempt to pass an String whose length is longer than 40 characters will be slapped by the run time. --... with pre => Right <= V_String_Length; Anh Vo