comp.lang.ada
 help / color / mirror / Atom feed
From: mab@dst17.wdl.loral.com (Mark A Biggar)
Subject: Re: Integer'Size < 32 ?
Date: 1996/08/11
Date: 1996-08-11T00:00:00+00:00	[thread overview]
Message-ID: <4ulinr$a7q@wdl1.wdl.lmco.com> (raw)
In-Reply-To: 9608081258.AA02749@most


In article <9608081258.AA02749@most> "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM> 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






  parent reply	other threads:[~1996-08-11  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-08  0:00 Integer'Size < 32 ? W. Wesley Groleau (Wes)
1996-08-09  0:00 ` Robert A Duff
1996-08-10  0:00 ` Robert Dewar
1996-08-11  0:00 ` Mark A Biggar [this message]
1996-08-12  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox