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-Thread: 103376,b3c479d8e293030d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!t19g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Unconstrained base subtype questions Date: Thu, 31 Mar 2011 15:18:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <8762qzm1ya.fsf@ludovic-brenta.org> <87wrjfkm57.fsf@ludovic-brenta.org> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1301609898 30240 127.0.0.1 (31 Mar 2011 22:18:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 31 Mar 2011 22:18:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t19g2000prd.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19612 Date: 2011-03-31T15:18:18-07:00 List-Id: On Mar 31, 2:36=A0pm, Ludovic Brenta wrote: > > Well, that's my question. In the calculation above, I clearly have an > > intermediate value that exceeds Integer'Last. And I tried something > > similar with Long_Long_Integer and still couldn't get an overflow > > error! So what is the actual limit on the base range of the type? Is it > > language defined, compiler defined, hardware defined, none of the above= ? > > It is both language- and implementation-defined. =A0I gave you the > references to what the language says. =A0The implementation-defined part > is the "base range of the type"; a sane implementation would choose a > range that matches the hardware. However, the language does specify that whatever base range the implementation chooses, Integer'Last will be the top of the range. It's not legally possible for the "base range" of Integer to include values that are larger than Integer'Last. (Note that that applies only to Standard.Integer; it "should" apply to other predefined signed integer types in Standard, but it doesn't apply to user-defined integer types.) The language does say, though (3.5.4(24)), that implementations don't need to raise Constraint_Error for arithmetic operations on signed integers as long as they produce correct results, even if intermediate results are outside the base range---that's what Randy was referring to, I think. -- Adam