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.50.6.102 with SMTP id z6mr1422253igz.10.1451958178372; Mon, 04 Jan 2016 17:42:58 -0800 (PST) X-Received: by 10.182.231.229 with SMTP id tj5mr133254obc.13.1451958178294; Mon, 04 Jan 2016 17:42:58 -0800 (PST) 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!h5no1971igh.0!news-out.google.com!l1ni3966igd.0!nntp.google.com!h5no1966igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Jan 2016 17:42:58 -0800 (PST) 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: <7dcd49f3-b04f-4ea3-b431-5c27f73b9afe@googlegroups.com> <87poxixqmy.fsf@theworld.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Instantiating package problems From: Anh Vo Injection-Date: Tue, 05 Jan 2016 01:42:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29015 Date: 2016-01-04T17:42:58-08:00 List-Id: On Monday, January 4, 2016 at 2:39:04 PM UTC-8, Anh Vo wrote: > On Monday, January 4, 2016 at 1:10:59 PM UTC-8, Dmitry A. Kazakov wrote: > > On 2016-01-04 21:49, Anh Vo wrote: > > > On Sunday, January 3, 2016 at 4:07:30 PM UTC-8, Andrew Shvets wrote: > > >> Hi Bob, > > >> > > >> Thanks for writing back. This is the entire example: > > >> http://pastebin.com/GEJT3WzL > > > > > > Just recommend to add a precondition to function Division as shown below. > > > By the way, this feature is part of latest Ada (Ada 2012). In addition, > > > you should think about adding precondition to other operations such as > > > Addition where Input1 + Input2 <= Integer'Last and Input1 + Input2 >= > > Integer'Last. > > > > > > function Division( > > > Input1 : in Integer; > > > Input2 : in Integer) > > > return Integer > > > with pre => Input2 /= 0; > > > > The correct precondition of integer division is > > > > Input1/Input2 in Integer'Range > > > > Note that it precludes zero divide, provided Ada 2012 can understand it, > > according to 3.5.4 (8) it must, but I am not a language lawer. > > Neither, I am a language lawyer. However, did not see paragraph LRM 3.5.4 (8) precluded zero divide for Integer type. Oops! There was an obvious typo. it supposed to read "However, I did not ... "