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: mab@dst17.wdl.loral.com (Mark A Biggar) Subject: Re: Integer'Size < 32 ? Date: 1996/08/11 Message-ID: <4ulinr$a7q@wdl1.wdl.lmco.com>#1/1 X-Deja-AN: 173553429 references: <9608081258.AA02749@most> organization: Loral Western Development Labs newsgroups: comp.lang.ada Date: 1996-08-11T00:00:00+00:00 List-Id: In article <9608081258.AA02749@most> "W. Wesley Groleau (Wes)" writes: >But I have a related question: many of the posts on the topic repeated >the definition > .... 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. >(I didn't use the parentheses, but that doesn't change the semantics.) >The ugly work-around was > .... range -2**31 .. 2**30 + (2**30 - 1); >My question is, "Is this a common 'feature'?" (Since so many people have >quoted the same example, I presume the answer is 'no') At minimum this is bad quality of implementation, for an Ada 95 compiler this appears to a compiler bug. Ada 95 basically used a duck* test for static expression and requires that they be evaluated at compile time even when they don't appear in a static context. *duck test: if it look like a duck, quacks like a duck, walks like a duck... etc, then it must be a duck even if you see it wahere no duck has ever apeared before. -- Mark Biggar mab@wdl.lmco.com