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!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Generic_Rational Date: Sat, 17 Feb 2018 14:47:09 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="b17bafe16e7bd0ca33ff125b591e6e22"; logging-data="23639"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Zwkpp5G/rUGkWRHcIgixMtt7LnsHF86Y=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:0UvGC1b6j+YGsuok1RgOvQOu1uE= sha1:BrqiTtaQ1bUk19EPkdRzTAZxdAo= Xref: reader02.eternal-september.org comp.lang.ada:50488 Date: 2018-02-17T14:47:09+00:00 List-Id: hnptz@yahoo.de writes: > Thanks, it's working now. Nevertheless a further question: > > Simon wrote > > "... When the test program says > > for Candidate in 2..2**15 loop > > Candidate is of type Integer (see ARM 3.6(17..18)[1], so that when it > says ... " > > Does a loop from 2..2**15 exceed the bounds of an integer type by one > ? (see also 3.5.4(21)). If so, then Candidate should be become a > Long_Integer type following 3.6(19). What may be wrong with this > interpretation? (18) says "If the type of the range resolves to root_integer, then the discrete_subtype_definition defines a subtype of the predefined type Integer with bounds given by a conversion to Integer of the bounds of the range"; and I'm pretty sure that means "the largest integer type suported by the implementation". GNAT's Integer is -2**31 .. 2**31 -1 , so 2**15 is well within. Long_Integer is -2**63 .. 2**63 - 1. for Candidate in 2..2**31 loop >>> value not in range of type "Standard.Integer" >>> static expression fails Constraint_Check for Candidate in 2..2**63 loop >>> warning: non-static universal integer value out of range >>> warning: "Constraint_Error" will be raised at run time >>> value not in range of type "Standard.Integer" >>> static expression fails Constraint_Check