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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae233931baf2d312 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Integer'Size < 32 ? Date: 1996/08/09 Message-ID: #1/1 X-Deja-AN: 173150002 references: <9608081258.AA02749@most> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-08-09T00:00:00+00:00 List-Id: In article <9608081258.AA02749@most>, W. Wesley Groleau (Wes) wrote: > .... range -(2**31) .. ((2**31)-1) > >I once used a compiler for which Integer'Size = 32 and which had an >interesting "feature." It recognized that the above would fit in 32 bits, >so it compiled for that size. Then at run-time, it would (obeying >the precedence rules) try to compute 2**31 and raise constraint_error. If you mean "type T is range -(2**31) .. ((2**31)-1);", then this cannot cause C_E, and never could, and would be a serious compiler bug if it did. I think you're thinking of this slightly different case: subtype S is Integer range 1..(2**31)-1; -- Assume Integer'Last = (2**31)-1. In Ada 83, the above *might* raise C_E. There was one compiler that I know of that would raise C_E -- all others I ever used would get the right answer. This problem has been fixed in Ada 95. In Ada 95 all static expressions are evaluated exactly, at compile time, without overflow. Therefore, the above cannot raise C_E in Ada 95. - Bob